I have a Data grid with DatagridComboBoxColumn , and i want to Fire Event SelectionChanged when user Select any thing From the ComboBox , Do Some operations ,
how can i do that any advice ,
thanks
I have a Data grid with DatagridComboBoxColumn , and i want to Fire Event
Share
You can handle your DataGridView’s
EditingControlShowingevent and cast the editing control to the ComboBox being displayed and then wire up itsSelectionChangeCommittedevent. Use theSelectionChangeCommittedhandler do you what you need to do.See the sample code in the MSDN article I linked for details.
Two important notes:
Despite the MSDN article’s sample code it’s best to use the
ComboBox
SelectionChangeCommittedevent, as discussed here and in thecomments of the linked MSDN article.
If you have more than one
DatagridComboBoxColumnin yourDataGridView you might want to determine which fired either your
EditingControlShowingor the ComboBox’sSelectionChangeCommittedevent. You can do this by checking your DGV
CurrentCell.ColumnIndexproperty value.I reworked the MSDN sample code a bit to show what I mean: