Hello ,
you can use TextChanged event of that textbox like this way .
private void txtenter_TextChanged(object sender, EventArgs e)
{
if (txtenter.Text.Trim().Length > 0)
{
foreach (DataGridViewRow dgvrow in dataGridView1.Rows)
{
dgvrow.DefaultCellStyle.BackColor = Color.YellowGreen;
}
}
else
{
foreach (DataGridViewRow dgvrow in dataGridView1.Rows)
{
dgvrow.DefaultCellStyle.BackColor = Color.White;
}
}
}
and then make foreach/ for loop to set the background color of the Datagridview . here i use
Trim()
for ignore the leading space while entering value in the textbox .
thanks