Question

I have a datagridview with columns bind to a dataset. One of the columns is a checkbox column which is unbound. I'm using cellPushed event to identify any changes being made to the checkbox and that works. My problem is that I can check the checkbox and get my functions working, but if I select other column or row the true value in the checkbox is disappeared.

Any ideas why is that?

Was it helpful?

Solution

I replicated your problem. I didn't use VirtualMode though so my checkboxcolumn retained its value properly when other cells were clicked.

DataGridView doesn't "remember" a value that was set for unbound combobox. It has to be stored manually in some way. The value will reset every time DataSource is touched (for example after sorting) and when you change cells (since you use VirtualMode)

http://social.msdn.microsoft.com/Forums/windows/en-US/a8dbb811-201a-42df-afe5-ddc3b1224386/change-value-of-an-unbound-datagridviewcheckboxcolumn-element?forum=winformsdatacontrols

http://msdn.microsoft.com/en-US/library/system.windows.forms.datagridview.iscurrentcellineditmode.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top