C Find Value In Datagridview

[Solved] C Find Value In Datagridview | Vb - Code Explorer | yomemimo.com
Question : c# find value in datagridview

Answered by : turner-kindred

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.");
}
}
}
}

Source : https://social.msdn.microsoft.com/Forums/en-US/dbedf9cf-7420-48d7-be9b-9f1f9c4adfb3/c-search-datagridview-and-show-results-in-dgv?forum=winformsdatacontrols | Last Update : Wed, 13 Jul 22

Answers related to c find value in datagridview

Code Explorer Popular Question For Vb