I have a DataGridViewControl named myGrid on a Form1 in a Visual Basic Project in Visual Studio 2008.
myGrid displays data from a database table in an SQL Server.
myGrid has two colums named Color and Comment. Color is the first Column in myGrid and Comment is the 2nd Column.
Both colums display text data.
Cells in the first (Color) Colum can have one of the three values: Red, Yellow and Green.
I would like to set the ForeColor property of all the cells in Column two (ie Column named Comment) based on the text in the adjacent cell in the first (ie Color) Column.
If the text contained in a cell in the first column (ie Color) is Yellow, then I would like the ForeColor of the cell immediately to the right of it (ie in Column 2 named Comment) to be Yellow and if the text contained in a cell in the first column (ie Color) is Green, then I would like the ForeColor of the cell immediately to the right of it (ie in Column 2 named Comment) to be Green. Similarly if the Content of a Cell Color Column is Red then I would like the Forecolor of the cell immediately to the right of it to be Red.
I would appreciate help with code that can achieve this for me.
Many thanks for your help in anticipation.