DataGridView.CellValueChanged - value not firing until out of the combobox cell
-
I have some
DataGridViewComboBoxColumn
s in my datagridview. I have all of the code working correctly but I would like to find a way to have the CellValueChanged event fire when the new value is selected in the comboboxcolumn and not after a value is selected AND I click outside of that cell to commit it.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
-
I have some
DataGridViewComboBoxColumn
s in my datagridview. I have all of the code working correctly but I would like to find a way to have the CellValueChanged event fire when the new value is selected in the comboboxcolumn and not after a value is selected AND I click outside of that cell to commit it.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
The Cell value won't change until the cell loses focus. Until then, you're still editing it. The Cell's value doesn't pickup the value of the ComboBox until focus is lost. This is when the SetValue method of the DataGridViewComboBoxCell is finally called, which sets the value of the DataGridViewCell, which fires the CellValueChanged event. The DataGridViewCombBoxCell doesn't expose any events itself, so I don't know how you're going to know when the ComboBox value changes.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007