DataGridView在加载大表时冻结UI

时间:2012-12-15 03:32:24

标签: vb.net asynchronous datagridview

以下代码冻结了我的用户界面。

'Load DataTable using backgroundworker with 15,000 records
...

'On backgroundworker's run completed event, pass loaded table
'and fill datagridview control

dim t as DataTable
t = DirectCast(e.Result, DataTable)

'This part takes very long and FREEZE UI
gridview.DataSource = t

有人有解决方法来修理装载部件吗? DataGridView中没有异步加载方法,我无法将gridView.DataSource = t放在backgroundworker线程中,因为它会与UI线程冲突。请帮忙..

1 个答案:

答案 0 :(得分:0)

使用Datagridview虚拟模式解决了这个问题。