开发者

DataGridView cell doesn't raise CellEndEdit until new cell is selected

I'm creating a DataGridView which is displaying a column of bool values. I'm using the visual designer in Visual Studio for making winforms and have added a column which has its "ColumnType" set to "DataGridViewCheckBoxCol开发者_如何转开发umn" so that check boxes appear instead of text fields.

I also do the following:

ElementDataGrid.CellEndEdit += new DataGridViewCellEventHandler(OnCellValueChanged);

The problem I'm seeing is that if I check the checkbox at runtime by clicking on it, the OnCellValueChanged doesn't get raised (verified both by my program not responding, as well as breakpoints not being hit). Then as soon as I select a different cell with the mouse, the event gets raised. It's as if the CellEndEdit doesn't get raised until the cell gets deselected.

I'd like the rest of my application to immediately respond as soon as the user checks the checkbox and not have to wait for the user to deselect it. Is there a different event I could use? I've also tried: * CellValidating * CellValidated * CellValueChanged But all seem to work the same - they require the user to select a different cell.


try using
DataGridView.CurrentCellDirtyStateChanged Event, which Occurs when the state of a cell changes in relation to a change in its contents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜