如图:

C# 获取DataGridView中的复选框

 

根据选中的复选框获得ID。

代码如下:

List<string> ids = new List<string>();  
foreach (DataGridViewRow row in dgrd_Human.Rows)
{
if (row.Cells["selected"].Value != null)
{
if(row.Cells["selected"].Value.ToString() == "True")
ids.Add(row.Cells[1].Value.ToString());
}
}
MessageBox.Show(string.Join(",", ids.ToArray()));


参考:http://www.wxzzz.com/?id=48

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-08-20
  • 2021-10-22
  • 2021-12-06
  • 2022-12-23
猜你喜欢
  • 2021-08-24
  • 2021-12-23
  • 2022-03-01
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案