数据网格视图复选框列 [英] Data Grid View Check Box Column
本文介绍了数据网格视图复选框列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果checked =true
,如何使用 DataGridViewCheckBoxColumn ,当您使用DataGridView中的行时.
How to use the DataGridViewCheckBoxColumn if checked =true
, When you use th rows from DataGridView.
推荐答案
检查一下:
将CheckBox列添加到DataGrid [
check this out:
Adding a CheckBox column to your DataGrid[^]
hope it helps :)
您的问题对我来说不是很清楚.如果要获取DataGridViewRows
的值为true的DataGridViewRows
,则可以尝试以下代码.
Your Question is not very clear to me. If you want to getDataGridViewRows
which are having checked value true forDataGridViewCheckBoxColumn
then you may try as below code.
foreach (DataGridViewRow dataGridRow in dataGridView1.Rows)
{
if (dataGridRow.Cells["YourCheckboxColumn"].Value != null && (bool)dataGridRow.Cells["YourCheckboxColumn"].Value)
{
// Checked
}
else if (dataGridRow.Cells["YourCheckboxColumn"].Value == null)
{
// Unchecked
}
}
这篇关于数据网格视图复选框列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文