I was trying to populate data in DataGridView control. It was getting populated into it correctly. But when I was trying to scroll down it was throwing an exception like;
> Value of '352' is not valid for 'Value'. 'Value' should be between
> 'minimum' and 'maximum'. Parameter name: Value
at System.Windows.Forms.ScrollBar.set_Value(Int32 value)
at System.Windows.Forms.DataGridView.ScrollRows(Int32 rowCount, Int32 deltaY, ScrollEventType scrollEventType)
at System.Windows.Forms.DataGridView.ScrollRowsByCount(Int32 rows, ScrollEventType scrollEventType)
The Dynamic binding was used to fill the Datagridview.
After a lot of debugging and searching this issue got resolved with just one statement.
I called dataGridView1.PerformLayout() after populating data.
Thanks to Google :)
> Value of '352' is not valid for 'Value'. 'Value' should be between
> 'minimum' and 'maximum'. Parameter name: Value
at System.Windows.Forms.ScrollBar.set_Value(Int32 value)
at System.Windows.Forms.DataGridView.ScrollRows(Int32 rowCount, Int32 deltaY, ScrollEventType scrollEventType)
at System.Windows.Forms.DataGridView.ScrollRowsByCount(Int32 rows, ScrollEventType scrollEventType)
The Dynamic binding was used to fill the Datagridview.
After a lot of debugging and searching this issue got resolved with just one statement.
I called dataGridView1.PerformLayout() after populating data.
Thanks to Google :)