mike Delvotti

mike Delvotti

  • NA
  • 262
  • 0

Change Datagrid Row on a Texbox Value

Jul 21 2014 11:14 AM

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)