3
Answers

Change Datagrid Row on a Texbox Value

mike Delvotti

mike Delvotti

10y
1.2k
1

Guys,

I'm trying to change my Datagridview Row forecolor on the value of my Textbox if it matches

My code below doesn't seem to work, am I missing something else?

 foreach (DataGridViewRow row in DataGridView1.Rows)
            {
                if (row.IsNewRow) break;
                object obj = row.Cells[0].Value;
                {
                    string content = obj.ToString();
                    if (content == param1ToolStripTextBox.Text)
                    {

                        row.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }


            }

Answers (3)