i need color particular cell in datagridview. tried doesn't work.
datagridview1.rows[1].cells[1].style.backcolor = color.red;
but whole column works...
datagridview1.columns[2].defaultcellstyle.backcolor = color.red;
then tried below code , did work performance of datagridview slow when comes 2k rows. possible make performance better or other way color particular cell in datagridview. thanks!
private void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) { datagridviewcellstyle makeitred = new datagridviewcellstyle(); makeitred.backcolor = color.red; //make whole column red datagridview1.columns[1].defaultcellstyle = makeitred; //make specific cell red datagridviewrow row2 = datagridview1.rows[2]; row2.cells[2].style = makeitred; }
Comments
Post a Comment