如何刷新第二个表单提交的第一个表单 [英] how to refresh first form on second form submit

查看:75
本文介绍了如何刷新第二个表单提交的第一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提交第二个按钮时提示第一个表单

Refersh first form while submit second button

推荐答案

您可以在第二个页面中使用click事件并以第一个表单订阅它。

检查如何在点击子窗体时刷新父窗体? [ ^ ]
you can use click event in second page and subscribe it in first form.
Check How to refresh parent form when in child form is button clicked?[^]


这真的取决于什么你正在做。

但是......如果你有这个:

Form1打开Form2。

Form2接受用户输入,用户按提交。



如果Form2然后关闭,你想要Form1中的数据,那么使用ShowDialog显示Form2,并在关闭时访问用户数据 - 这将是下一个指令。 (您应该在使用数据之前检查确定/取消)。这类似于使用MessageBox或OpenFileDialog时发生的情况。



如果Form2保持打开状态,则在Form1处理的Form2中创建一个偶数。在事件处理程序中,使用 sender 参数来标识Form2的实例,并再次访问该信息。



在这两种情况下,使用Form2中的Properties来提供信息:不要直接公开控件!
It really depends on what you are doing.
But...If your have this:
Form1 opens Form2.
Form2 takes user input, user presses Submit.

If Form2 then closes, and you want the data in Form1, then use ShowDialog to display Form2, and access the user data when it closes - which will be the next instruction. (You should check for OK / Cancel before using the data). This is similar to what happens when you use a MessageBox or OpenFileDialog.

If Form2 stays open, then create an even in Form2 which Form1 handles. In the event handler, use the sender parameter to identify the instance of Form2, and again access the information.

In both cases, use Properties in Form2 to supply the information: do not expose controls directly!


这篇关于如何刷新第二个表单提交的第一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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