JZTXT
  • 首页
  • Ai
  • Java
  • Python
  • Android
  • Mysql
  • JavaScript
  • Html
  • CSS

关于DataGridView中的c#:CheckBox值始终为true

发布时间 2023-07-25 16:03:12作者: simadi

使用CellContentClick事件,然后使用EditedFormattedValue属性

 private void compGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                if ((bool)compGridView.Rows[e.RowIndex].Cells[0].EditedFormattedValue)
                {
                    ComputersList.Add(compGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
                }
                else
                {
                    ComputersList.Remove(compGridView.Rows[e.RowIndex].Cells[1].Value.ToString());
                }
            }
        }

 

    本栏目推荐文章
  • 为什么重写equals 和 hashcode 方法,lombok中@EqualsAndHashCode(callSuper = false/true) 什么区别
  • 【转】C# WinForm 自定义控件,DataGridView背景透明,TabControl背景透明
  • IIS——应用程序池——高级设置——启用32位应用程序 :true
  • comp->SetIsReplicated(true) 与 actor->SetReplicateMovement(true)
  • many=True源码分析,局部全局钩子源码解析
  • winform DataGridView设置行高
  • Error: testWhileIdle is true, validationQuery not set
  • 为什么Java中“1000==1000”为false,而”100==100“为true?
  • System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead
  • pytorch反向传播错误解决:RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.
版权声明:本网站为非赢利性站点,本网站所有内容均来源于互联网相关站点自动搜索采集信息,相关链接已经注明来源。
联系我们