开发者

Datagridview error : Value' should be between 'minimum' and 'maximum'

I am trying to populate data in DataGridView control. It gets populated into it. But when I try to scroll down it gives me an exception l开发者_开发百科ike;

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) 

Does anyone know how to resolve this issue ?

I am using DataSource property and not Rows.add()

Thanks in advance


It got resolved by dataGridView1.PerformLayout() after populating data.


The similar kind of problem was faced by me too recently , I was using datagridview for entering the data in my database , everything worked fine but whenever I try to edit the data then it throws exception the moment I crossed 18 th row . The solution to this problem is use dgv.PerformLayout(); , call to this function will resolve the problem and exception wont be thrown

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜