【问题标题】:DataGridView and CheckBoxDataGridView 和 CheckBox
【发布时间】:2012-05-30 13:32:33
【问题描述】:

我使用数据集将数据库连接到 DataGridView 并设置:

DataGridView.autogenerate=false

然后我使用 gui 属性逐列添加,然后我将其中一列设置为复选框。

首先我想将复选框的值设置为真或假,然后检查该值是否为真,如果为真,那么我想获取另一列但在同一行中的值,然后隐藏当前行。

【问题讨论】:

  • 我想知道您使用的是什么 API... Winform? ASP.NET? WPF?银光?
  • 我正在使用 c# windows 论坛应用程序

标签: c# winforms


【解决方案1】:

首先,您需要检查该单元格是否被选中。

if (DataGridViewRow.Cells[CellNumber].Value != null)
{
    if ((Boolean)DataGridViewRow.Cells[CellNumber].Value == true)
    {
        //Get other cell value
    }
}

执行此操作后,您可以隐藏该行。

DataGridViewRow.Visible = false;

【讨论】:

    猜你喜欢
    • 2020-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-29
    相关资源
    最近更新 更多