简体   繁体   English

C#从无模形式传递值

[英]C# Pass Values from Modeless Form

I am currently in the process of changing my modal form to modeless. 我目前正在将模式形式更改为无模式。 The modal form was at the beginning of a method and I utilized the values within the form in this method. 模态形式是方法的开始,我在这种方法中利用了形式内的值。 Now that I'm changing it to modeless, I have it set to open the form, then in the closed event I call that method. 现在,我将其更改为无模式,将其设置为打开表单,然后在关闭事件中调用该方法。 But my problem is, how do I retrieve the values from the form? 但是我的问题是,如何从表单中检索值? Since it's closed, I can't use the simple form.Value like I was when the dialog was modal. 因为它是关闭的,所以我不能使用简单的form.Value就像对话框是模式对话框时一样。

Thanks so much! 非常感谢!

Subscribe to the 'FormClosing' event and save the data from the form. 订阅“ FormClosing”事件并保存表单中的数据。
I'm fairly certain the 'FormClosing' is the event you need because 我相当确定“ FormClosing”是您需要的事件,因为
The form is not yet disposed when you reach this event. 到达此事件时,该表单尚未处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM