Closing a form

  • Thread starter Thread starter Gas
  • Start date Start date
G

Gas

Hi,

I am a totally C# newbie from VB6.

In my App, I don't know why the form_closing event is never being raised
when I click on the "x" button at the corner my App,
Can anyone give me some hints?

Also I want to know how can I get a list of events for an object( say form)
just like the combo box we use in VB6 editor (at the top)?
(I used to go to the web and copy the
"private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)"
declaration myself, and this is not good for me to do it for every event
for every contols)

Please give me some help, thanks

Gas
 
I'm not sure why Closing isnt' firing, how have you confirmed that it isn't?

As for the list of events, click on the Little Lightning bolt in the middle
section of your properties window, they are all listed there.
 
Hi Gas,

Maybe you have not bound the handler properly. Recheck that.

In design view, click on the control you want to know the events of, then
click on the lightning icon in the properties window.

HTH,
Rakesh Rajan
 
Gas,

Are you talking about the simple


private void Exit(object sender, System.EventArgs e)
{
this.Close();
}


??

As Rakesh Rajan mentioned as well.. check if you bounded the handler
correctly :)
 
Did yo add the event delegate properly...

If you are not using a development tool follow me

first add this to the contructor of the form you are talking about
this.Closing += new
System.ComponentModel.CancelEventHandler(this.myForm_Closing);

then write the delegate method as

private void myForm_Closing(object sender,
System.ComponentModel.CancelEventArgs e)

{

}

Now... if it is not firing you may have some other problem...

Nirosh.
 
Back
Top