C#backgroundworker中更新datagridview出现滚动条问题

在使用BackgroundWorker完成数据更新时,遇到DataGridView页面闪烁和滚动条异常问题,导致无法滚动到底部。错误发生在ScrollBar.set_Value方法中。解决办法包括:1) 使用委托刷新防止闪烁;2) 更新数据后调用dataGridView1.PerformLayout()来修复滚动条问题。
摘要由CSDN通过智能技术生成

问题具体描述:

在backgroundworder_complete中更新datagridview的数据,出现以下问题:

1、页面不停闪烁;

2、滚动条无法拖动至最下面一条数据,用键盘一行行往下推,到某一行崩溃,出现如下描述的错误

   在 System.Windows.Forms.ScrollBar.set_Value(Int32 value)
   在 System.Windows.Forms.DataGridView.ScrollRows(Int32 rowCount, Int32 deltaY, ScrollEventType scrollEventType)
   在 System.Windows.Forms.DataGridView.ScrollRowsByCount(Int32 rows, ScrollEventType scrollEventType)
   在 System.Windows.Forms.DataGridView.ScrollRowIntoView(Int32 columnIndex, Int32 rowIndex, Boolean committed, Boolean forCurrentCellChange)
   在 System.Windows.Forms.DataGridView.ScrollIntoView(Int32 columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
   在 System.Windows.Forms.DataGridView.ProcessDownKeyInternal(Keys keyData, Boolean& mov

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值