Tuesday, March 22, 2011

Forcing DataGridView to Refresh when changed

This works - save DataSource, save scroll position, restore datasource, restore scroll position, e.g.

private void forceRefresh()
{
int x = dgvMusicalScaleList.FirstDisplayedScrollingRowIndex;
dgvMusicalScaleList.DataSource = null;
dgvMusicalScaleList.DataSource = musicalScaleList;
dgvMusicalScaleList.FirstDisplayedScrollingRowIndex = x;
}

No comments:

Post a Comment