Click here to Skip to main content
15,887,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C#
private void av_StatIn_Closing(object sender, FormClosingEventHandler e)
{
 MessageBox.Show("Something");
}
Posted
Updated 12-Jan-12 0:21am
v2

1 solution

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.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Jan-12 23:00pm    
Yes, those are most likely reasons, a 5. The question is incomplete, as many similar ones.
--SA
galextudor 13-Jan-12 10:30am    
Yeah, I figured it out a few hours after a break. Thanks guys.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900