FormClosing无法正常工作? [英] FormClosing isn't working?

查看:54
本文介绍了FormClosing无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,

我刚刚开始为我的一个朋友编写应用程序,但我一直遇到问题,根本无法弄清原因.
我有一个主要的形式,它是一个MDI容器,用于一堆其他形式.

我要做的是检查子窗体何时关闭,并在发生这种情况时在屏幕上显示一条消息.因此,我尝试将这段代码放入子窗体中,但是无论我使用哪种方式关闭窗体,它都无济于事.

有什么线索吗?谢谢.

Hey,

I''ve just started writing an app for a friend of mine and I keep getting a problem and simply can''t figure out why.

I have a main form which is a MDI container for a bunch of other forms.

What I''m trying to do is check when a child form is closing and putting a message on screen when that happens. And as such, I''ve tried putting this code inside the child form, but whatever mode I use to close the form, it simply does nothing.

Any clues? Thank you.

private void av_StatIn_Closing(object sender, FormClosingEventHandler e)
{
 MessageBox.Show("Something");
}

推荐答案

您是否连接了事件处理程序?还是只添加代码?

并将其连接到Closing或FormClosing吗?
前者在.NET Framework 2.0版中已过时,在更高版本中可能无法使用.
Did you wire up the event handler? Or just add the code?

And did you wire it to Closing or FormClosing?
The former is obsolete in the .NET Framework version 2.0, and may not work in later versions.


这篇关于FormClosing无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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