I\'ve encountered a bug (I assume) in .NET 3.5. When adding rows to a DataGridView using Rows.Add(), while the DGV is disabled, the vertical scrollbar doesn\'t update proper
For me the problem was that I put my datagrid in a TabPage which was not displayed during data generation time so the srolling was messed up.
I found a was to make a correct update just by auto diable/enable at each visible change :
public MyForm()
{
InitializeComponent();
// Automatic scroll to bottom (it might not work if you try to do it without this event)
datagrid.RowsAdded += (sender, e) =>
{
datagrid.FirstDisplayedScrollingRowIndex = datagrid.RowCount - 1;
};
// WinForms bug fix: scrollbar update
datagrid.VisibleChanged += (sender, e) =>
{
Enabled = false;
Enabled = true;
};
}