在判断DataGridView中CheckBox选中列的时候,发现明明选中了CheckBox,但DataGridViewRow.Cells[0].FormattedValue值却为False.

解决方法:

1、在调用前提交操作,代码如下。然后使用FormattedValue取值。

//提交DataGridView修改的值
dgvWorkRecord.CommitEdit(DataGridViewDataErrorContexts.Commit);

 

 

2、直接使用EditedFormattedValue。

    FormattedValue是操作提交后的结果,而EditedFormattedValue是当前的结果,不管结果是否已经提交。

相关文章:

  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2021-06-02
  • 2021-07-27
  • 2022-01-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
相关资源
相似解决方案