Hello all,
I cannot seem to be able to find a way to do a full text search on a databound DataGridView control across the entire breath of its columns and rows.
The DataTable and DataView objects seems to force me into searching for specific columns either through Select(), Find(), or FindRows(). Same with the DataGridView control.
I have one search string and I need to run it against the whole contents of the DataGridView. I'm sure the answer lies somewhere close. But I cannot seem to be able to find it at this stage in my apprenticeship of C# and the .Net framework.
This is my current solution which I would like to avoid:
/*...*/
for (int i = found_last_row + 1; i < dataGridRes.Rows.Count; ++i)
{
for (int j = 0; j < dataGridRes.Columns.Count; j++)
{
if(dataGridRes.Rows[i].Cells[j].Value.ToString().Contains(search_last_str.))
{
dataGridRes.Rows[i].Selected = true;
dataGridRes.FirstDisplayedScrollingRowIndex = i;
found_last_row = i;
break;
}
}
}
/* ...*/