如何在Visual Studio表单中刷新数据gridview? [英] How to refresh data gridview in visual studio form?

查看:141
本文介绍了如何在Visual Studio表单中刷新数据gridview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个带有网格视图数据和数据库数据的表格.通过查询,我可以通过按钮将INSERT INTO从一个表运行到另一个表.我想在运行过程时,还使用新的导入数据重置/更新/刷新gridview.

对于信息,我尝试了一些方法,例如me.gridview.refresh()update(),但是什么也没有.也许我也用错了这种方法.

Hi,

I have a form with gridview data with database data. With query I run INSERT INTO from one table into another, with button. I would like when I run procedure, also reset/update/refresh gridview with new import data.

For info, I have try with some methods, such as me.gridview.refresh() or update(), but nothing. Maybe I have also using this methods wrong.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim TEST = New WindowsApplication1.IdisDataSetTableAdapters.QueriesTableAdapter
        TEST.InsertQuery()
        
End Sub



[OP的问题答案已移动]

找到解决方案.我又打了一次Fill ... :-)



[Moved answer of OP to question]

Found solution. I have call again Fill... :-)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TEST = New WindowsApplication1.IdisDataSetTableAdapters.Queri esTableAdapter
TEST.InsertQuery()
Me.IdisTableAdapter.Fill(Me.IdisDataSet.Idis)
End Sub



预先感谢您对任何人的帮助!



Thank you in advance for help to anyone!

推荐答案

如果将gridview绑定到BindingSource [
If you bind your gridview to a BindingSource[^] and your DataSource to the BindingSource, you might be able to use the BindingSource.ResetBindings or ResetcurrentItem or ResetItem methods, although the BindingSource should do this automatically.


我认为您必须将数据源重新绑定到GridView.但是我无法在您的事件处理程序中找到任何与Gridview相关的代码.

最好的问候,
曼弗雷德(Manfred)
I think you''ll have to rebind the datasource to the GridView. I can''t locate any gridview related code in your event handler though.

Best Regards,
Manfred


这篇关于如何在Visual Studio表单中刷新数据gridview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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