更新datagridview(win窗体)中的记录,而无需重新绑定它 [英] update records in datagridview (win forms) without re-bind it

查看:74
本文介绍了更新datagridview(win窗体)中的记录,而无需重新绑定它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在VB.net中有一个应用程序.

在我的应用程序中,我有一个datagridview控件,该控件绑定到XML数据源. XML是在每个Web服务调用上生成的.每次Web服务调用时,都会生成XML记录,该记录绑定到datagridview控件.

绑定期间,首先清除所有行,然后从XML添加新行,然后我丢失了选择(选择完整行).我不要这样我只想从XML绑定datagridview更新中没有的行,并且从XML记录中删除不在XML中的记录,就像更新面板一样.

Hi,

I have an application in VB.net.

In my application I have a datagridview control which in bound to an XML data source. The XML is generated on each web service call. Every time the web service calls, it results in an XML records which is bound to the datagridview control.

During binding all the rows are cleared first then new rows added from the XML and I lost my selection (select full row). I don''t want it like this. I want to bind only the rows that are not in the datagridview updates from the XML and the records not in XML are removed from the datagridview control just like update panel.

推荐答案

DataGridView具有属性和方法.记住选定的行(选定的索引),重新绑定数据源并再次设置选定的行.
DataGridView has properties and metods. Remember selected row (selected index), rebind datasource and set selected row again.


这篇关于更新datagridview(win窗体)中的记录,而无需重新绑定它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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