I have a windows forms DataGridView. That I fill and update using the code below, all pretty straightforward and it is all done on the UI thread.
For some strange reason sometimes the size of the vertical scrollbar (wich I set to be only visible when needed) does not reflect the amount rows available. If I scroll all the way down, I still cannot see the very last rows. I can tell by selecting the lines below (and bringing them into view) by using the arrow down key.
What could possibly be a reason for this. Do I need some sort of BeginUdate or SuspendLayout or something? The control is embedded through interop in an MFC application.
Andy idea how to track down this problem? Is this a known bug? Google doesn't think so, it seems.
Here is the code I use.
adding or inserting a row:
int newRowIndex = insertAt;
if (insertAt < 0 || insertAt > this.dataGridView.Rows.Count)
{
newRowIndex = this.dataGridView.Rows.Add();
}
else
{
this.dataGridView.Rows.Insert(insertAt, 1);
}
removing a row:
this.dataGridView.Rows.Remove(index);
clearing:
this.dataGridView.Rows.Clear();
updating a row:
this.dataGrid[0, rowIndex].Value = someString;
this.dataGrid[1, rowIndex].Value = someBool;
this.dataGrid[2, rowIndex].Value = someInt;