1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help with foreach

Discussion in 'C#' started by NH1, Aug 28, 2010.

  1. NH1

    NH1 Guest

    Im trying to change the color of a row when the value of one of my columns is changed to Terminated.

    for example when an employee is termiated i want the color of his record to be red.

    this is the code i have so far.

     foreach (DataRow dr in dt.Rows)
                   if (dr[9].ToString() == "Terminated")
                        dataGridView5.BackgroundColor = Color.Blue;

Share This Page