c# - How do I check if a combobox in a datagridview equals a certain value? -


i'm creating ordering system booking customers in, , want combobox in datagridview able mark job complete, , change colour of row green when yes selected, i'd please have no idea how it, have looked on internet , found nothing.

this screenshot of database, , appreciated.

i'm using winforms

thanks in advanceenter image description here

you have use cellvaluechanged event.

private void gridcellvaluechanged(object sender, datagridviewcelleventargs e) {     //just safe     if (e.rowindex < 0 || e.columnindex < 0)     {         return;     }      var value = datagridview1[e.columnindex, e.rowindex].value;      if (value != null && value.tostring() == "yes")  // completed     {        datagridview1.rows[e.rowindex].defaultcellstyle.backcolor = color.green;     }     else     {         datagridview1.rows[e.rowindex].defaultcellstyle.backcolor = color.white;     } } 

hope helps :)


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -