.net - How to execute event from another event? -
i have datagridview bound table. table's columns idtransaction amount transactiontype.
i want change color of amount cells based on transactiontype.
if (transactiontype==1) cell.backgroundcolor=red; else cell.backgroundcolor=white; where recommend me it?(in event)
thank you
for windows forms typically put code in cellformatting event
private void datagridview1_cellformatting(object sender, datagridviewcellformattingeventargs e) { if (this.datagridview1.columns[e.columnindex].name = "transactiontype") { if (e.value != null) { if (e.value == 1) { e.cellstyle.backcolor = color.red; } else { e.cellstyle.backcolor = color.white; } } } }
Comments
Post a Comment