.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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -