WinForms:在DataGrid中填充行使用线程,但gridcontrol应该响应。 [英] WinForms: Filling Rows in DataGrid Using Threading and yet gridcontrol should be responsive.

查看:91
本文介绍了WinForms:在DataGrid中填充行使用线程,但gridcontrol应该响应。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WinForms应用程序。 C#,. NET 3.5。

WinForms Application. C#, .NET 3.5.

我有一个函数可以将数据搜索到非RDBMS源中,收集数据并插入每个找到的记录进入DataSet,最后将DataSet返回给主模块。 主模块将返回的数据集绑定到WinForms网格控件。  当用户
单击任何行时,它应显示所选行的详细信息。

I have a function with searchs data into a non RDBMS Source, collects data and Inserts each found records into DataSet and finally it returns DataSet to main module.  The main module binds returned Dataset to WinForms Grid Control.  When user click on any row, it should display details of selected row.

搜索需要很长时间时间,因此我想使用线程,以便当函数找到数据时,它将数据返回到主模块,主模块将数据添加到DataSet对象中,该对象已经绑定到网格控件。 Grid控件
应该在其底层数据集中找到新数据时自动刷新。 当搜索正在进行时,网格控件应保持响应,以便当用户点击任何行时,我可以调用anothr函数来检索所选
行的详细信息。

The search takes quite long time and hence i want to use threading such that as the function find the data it returns the data to main module and main module adds the data into a DataSet object which will be already binded to Grid Control. The Grid control should automatically refresh itself as he finds new data in its underlying databset.  While search is going on the Grid control should remain responseive so that when user clicks on any row, I can call anothr function to retrieve details of the selected row.

我试过使用BackgroundWorker仍然会冻结UI。我观察到网格控件没有自我刷新并且没有响应。

I tried using BackgroundWorker still the UI freezes. I observe the grid control does not refresh itself and is non-responsive.

请指导如何实现这一点,如果GridControl在类似的行上有任何样本,我真的很想。

Please guide on how to achieve this and I would really like if there is any sample on similar lines with GridControl.

关心

Jiya。

Regards
Jiya.

 

 

 

 

 

推荐答案

该函数是否在每次调用时返回一行数据?
does the function return one row of data on each call?


这篇关于WinForms:在DataGrid中填充行使用线程,但gridcontrol应该响应。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆