private void tb_Search_TextChanged(object sender, EventArgs e)
{
string searchValue = tb_Search.Text;
int rowIndex = -1;
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
try
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[0].Value.ToString().Contains(searchValue))
{
rowIndex = row.Index;
dataGridView1.ClearSelection();
row.Selected = true;
dataGridView1.FirstDisplayedScrollingRowIndex = rowIndex;
dataGridView1.Focus();
break;
}
}
}
catch (Exception)
{
MessageBox.Show("No solutions with that name.");
}
}
}
}