问题描述
限时送ChatGPT账号..web中传递表单的所有教程都是从form1然后打开form2然后传值.
All the tutorial in passing forms in the web are all from form1 then open form2 and then pass the value.
我想要一些相反的东西.form1 和 form 2 是打开的,所以如果你在 form2 中点击确定,你在 form 2 中得到的值将在 form 1 中传递.
I want something reverse. form1 and form 2 is open so if you click ok in form2 the value you get in form 2 will be passed in form 1.
例如.form1 单击按钮 openform2button(表单 2 显示)在文本框(在表单 2 中)上写 7(数字 7)单击按钮 okbutton 然后表单 2 在表单 2 关闭后关闭表单 1 中的文本框会将数据存储在表单 2 中.因此,您将放入文本框 form2 中的 7 将保存并传输到文本框 form1 中.这可能吗?
ex. form1 click buttton openform2button (form 2 shows) write 7 (number 7) on a textBox (in form2) click button okbutton then form 2 closes after form2 closes the textbox in form1 will store the data in form2. so the 7 you will put in textbox form2 will be saved and transferred in textbox form1. is that possible?
推荐答案
有多种方法可以做到:
在 form1 和 form2 之间共享一个模型对象.让 form2 公开一个 form1 订阅的事件.传递事件参数中的值.让 form2 将该值公开为 form1 在 form2 关闭后读取的公共属性.这篇关于从另一个窗体 Winforms 传递值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论