天天看点

循环遍历DataGridView各行某列数据

循环遍历DataGridView各行某列数据

foreach (DataGridViewRow dgr in dataGridView1.Rows)
{
    if (dgr.Cells["Column1"].Value == null)
    {
        break;
    }
    label1.Text += dgr.Cells["Column1"].Value.ToString() + " ";
}