1.DataGridView(winform)中,CheckBox列的选中问题

      在判断DataGridView中CheckBox选中列的时候,用DataGridViewRow.Cells[0].FormattedValue.ToString()=="True"语句时存在问题,当我们直接点击CheckBox时,结果显示未选中,但是如果我们在点击其他单元格时,结果显示选中。而用DataGridViewRow.Cells[0].EditedFormattedValue.ToString()=="True"语句时不管怎么样是选中的状态。为什么会有这种结果?

      原因就是FormattedValue是操作提交后的结果,而EditedFormattedValue是当前的结果,不管结果是否已经提交。所以用DataGridViewRow.Cells[0].EditedFormattedValue.ToString()=="True"判断选中比较合适。

posted @ 2009-12-15 09:25  Dandy.He  阅读(946)  评论(0编辑  收藏  举报