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.

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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice