How do you color code a column of cells at load event?


  • Hello,

    I have a datagridview that when you enter a value less than 50% in column 6 the text will change to red bolded font.
    dgView1.CurrentRow.Cells(6).Style.ForeColor = Color.Red
    dgView1.CurrentRow.Cells(6).Style.Font = New Font("Arial", 8.25, FontStyle.Bold)
    When I reload the datagridview, the fonts return to the origional color. I'm thinking I may need a loop to loop through the values of the dataset and look at the values in column 6 and if it is below 50% then apply formatting to it? How could I accomplish this?

    Thanks in advance.
    Wednesday, July 29, 2009 4:53 PM


  • Where is the code you posted situated? Try putting it in a handler for the RowFormatting event of your datagrid. It should fire every time.
    Wednesday, July 29, 2009 8:27 PM