Soldato
Hi all.
Got a winforms application and it uses DataGridViews to display data from an SQLite table via a dataset. There is a background poller that refreshes the datasets. When this happens I want the selected row to be reselected after the refresh. This is what I've done which I thought should work;
Any ideas?
Got a winforms application and it uses DataGridViews to display data from an SQLite table via a dataset. There is a background poller that refreshes the datasets. When this happens I want the selected row to be reselected after the refresh. This is what I've done which I thought should work;
Code:
DataGridViewCell currentCell = this.dataGridViewQueue.SelectedRows[0].Cells["id"];
dtQueue.Clear();
daQueue.Fill(dtQueue);
foreach (DataGridViewRow row in this.dataGridViewQueue.Rows)
{
if (currentCell.Value != null)
{
if (row.Cells["id"].Value.ToString() == currentCell.Value.ToString())
{
row.Selected = true;
}
}
}
Any ideas?