本文介绍了无法从其他表单刷新datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 下午女士和男士。 我有一个可视化的基本MDI表单应用程序,允许用户查看和添加查询。我似乎无法从另一个表单更新一个表单中包含的gridview。 申请表的工作流程如下 工作流程描述 1)父MDI(​​称为'Form1')打开 2)当Form1启动时它打开另一个名为'frmEnquiryBrowser'的表格 3)frmEnquiryBrowser包含当前查询的数据网格视图(称为grdEnquiryView) 4)Form1还包含一个菜单条项,打开一个名为'frmAddEnquiry'的表单 5)用户通过frmEnquiry添加新查询表格。 6)当frmEnquiry保存并关闭时,我希望打开frmEnquiryBrowser gridview'以刷新或更新添加的查询。 我希望这有意义吗? 我尝试了几种方法, - 将grdEnquiryView刷新方法公开并从frmAddEnquiry调用它 - Instantiatin g frmEnquiryBrowser作为一个表单并尝试以这种方式访问​​它。 - 我可以从Google获取的其他所有内容 似乎因为frmAddEnquiry尚未作为frmEnquiryBrowser的对话框打开我无法更新它的gridview。 任何帮助都会非常感激。解决方案 Afternoon Ladies and Gents.I have an visual basic MDI Form Application that allows users to view and add enquiries. I cannot seem to update a gridview contained in one form from another form. The workflow of the application is as followsWork Flow Description1) The parent MDI (called 'Form1') opens2) When Form1 is initiated it opens another form called 'frmEnquiryBrowser'3) frmEnquiryBrowser contains a data grid view (called grdEnquiryView) of the current enquiries4) Form1 also contains a menu strip item that opens a form called 'frmAddEnquiry'5) The user adds a new enquiry via the frmEnquiry form.6) When the frmEnquiry saves and closes I wish to have the open frmEnquiryBrowser gridview' to refresh or update with the added enquiry.I hope this makes sense?I have tried several methods such,- Making the grdEnquiryView refresh method public and calling it from frmAddEnquiry- Instantiating frmEnquiryBrowser as a form and trying to access it this way.- Everything else I could scrape from GoogleIt seems that because the frmAddEnquiry has not been opened as a dialogue from frmEnquiryBrowser i cant update it's gridview.Any help would be much appreciated. 解决方案 这篇关于无法从其他表单刷新datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-29 15:12