在此表单关闭时打开此表单和上一个表单 [英] open this form and previous form when this form is closed

查看:119
本文介绍了在此表单关闭时打开此表单和上一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有三种形式,当我点击设置表单时,第二种形式的
,设置表格将被打开。如果在设置表单中进行了任何更改,并在保存设置后,将关闭设置表单,并且应关闭第二个表单并打开第一个表单。

如果在设置中没有进行任何更改,只需点击关闭设置表单即可关闭...





如果有任何更改并点击保存按钮,那么只有两个设置(form3)和form2应该关闭..

你能帮忙吗...


i had three forms,
in second form when i click on settings form, settings form will be opened. if any changes are made in the settings form and after saving the settings, settings form will be closed and second form also should be closed and first form should be opened.
if no changes are done in settings and simply click on close settings form will be closed...


if any changes are made and click on save button then only both the settings(form3) and form2 should be closed..
can you please help in this..

推荐答案

1.declare任何全局变量或标志,您可以设置是否发生了任何更改。它很简单。

2.你必须在关闭按钮点击时检查该变量的值。以下是获得该代码的代码。

1.declare any global variable or flag where you can set that is there any changes happened or not. Its simple.
2. You have to check that variable's value on close button click. Here is the code to get that.
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
    if (string.Equals((sender as Button).Name, @"CloseButton"))
        // Do something proper to CloseButton.
    else
        // Then assume that X has been clicked and act accordingly.
}



来源:点击这里 [ ^ ]



3.结账表格和开标表格。



完成。


Source : Click Here[^]

3. Closing form and opening form.

Done.


这篇关于在此表单关闭时打开此表单和上一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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