Pergunta

I have a problem on my datagridview containing datagridviecomboboxColumn. i need fire a selectedindex change event after the user selected new items from the combobox. how can i do that? i have a work around but it seems lik it might not be correct:

Datagridview1_CellValueChanged(object sender, DataGridViewRowCancelEventArgs e)

but it only fire after the user leave the cell where the combo box were position,what i need is an event like selectedindex change.

Please help me to solved this problem. thanks ;)

Foi útil?

Solução

From the MSDN: Unlike the ComboBox control, the DataGridViewComboBoxCell does not have SelectedIndex and SelectedValue properties. Instead, selecting a value from a drop-down list sets the cell Value property.

So CellValueChanged seems like the way to do it.

If you want to it without the user having to leave the cell, you can use CurrentCellDirtyStateChanged.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top