如何获得gridview中CheckedBoxlist选中行中的值

来源:百度知道 编辑:UC知道 时间:2024/06/25 08:08:59

for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
if (this.dataGridView1.Rows[i].Cells[3].Value != null
&& (bool)this.dataGridView1.Rows[i].Cells[3].Value)
{
//或者在加个循环列,或者根据列名取
string str = Convert.ToString(this.dataGridView1.Rows[i].Cells[0].Value);
string str1 = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
string str2 = this.dataGridView1.Rows[i].Cells[2].Value.ToString();
}
}
this.dataGridView1.Rows[i].Cells[3] 是CheckBox列