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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -