c# - DataGridViewComboBoxCell - needs 2 clicks to get the current selected index -
i have code :
private void vicationdatagridview_editingcontrolshowing(object sender, datagridvieweditingcontrolshowingeventargs e) { if (zawag) { combobox cbo = e.control combobox; if (cbo != null) { if (cbo.selectedindex == 6) { messagebox.show("test"); } } } }
when run app, code not work untill click combobox 2 times , 3 clicks, need let work first click when user select value first time.
i tried set editmode editonenter problem not solved.
you need use datagridview's editingcontrolshowing
event add event handler selectedindexchanged
event of combobox in grid. can move code have testing combobox's selectedindex
method that's invoked when selectedindexchanged
event fires.
there's great example in msdn.
Comments
Post a Comment