更新Datagrid VB2008 [英] Updating a Datagrid VB2008

查看:89
本文介绍了更新Datagrid VB2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧VB.NET专家,这位vb.net新秀需要您的专业知识如何刷新"数据网格.

背景:
Form1具有一个Datagrid,通过将DB拖动到datagrid中创建了Dataset1.
Form2呈现从数据网格中选择的记录.在LOAD_FORM中,我使用关键字"搜索数据库,并将数据放入Dataset2(手动创建的DS)中.

挑战:
在Form2中更新的记录保存在DBfine中,并且在关闭Form2时,更新的记录不会出现在Form1中.

我尝试了以下操作,但没有成功
在form1结束活动中,我获得了将数据加载到DS中的代码

Ok VB.NET gurus, this vb.net rookie needs your expertise how to ''refresh'' a datagrid.

BACKGROUND:
Form1 has a Datagrid, Dataset1 created by drag DB into datagrid.
Form2 presents the record selected from the datagrid. Within the LOAD_FORM I search the DB with the "Key" and place data in Dataset2 (DS created manually)

CHALLENGE:
Record updated in Form2 is saved in DB fine and when Form2 is closed, record updated does not appear in Form1.

I’ve tried the following but no sucess
In form1 closing event I’’ve got the code to load data into the DS

Me.TUSERSTableAdapter.Fill(Me.PTDataSet.TUSERS)



我应该怎么做才能看到数据网格最终更新?



What should I do to see the datagrid finally updated?

推荐答案

最简单的方法是设置DGV的数据源再次.您可能必须先将其设置为Nothing.

但是,当然,这取决于您绑定DGV的对象.您的代码看起来像..... ??
The easy way to do it is to just set the DataSource of the DGV again. You might have to set it to Nothing first.

But, of course, this depends on what you''re binding the DGV to. Your code for this looks like .....??


这篇关于更新Datagrid VB2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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