472,141 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

Closing a form

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
Nov 16 '05 #1
4 3524
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.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Gas" <ga****@hotmail.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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

Nov 16 '05 #2
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" <ga****@hotmail.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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

Nov 16 '05 #3
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 :)


On Thu, 7 Oct 2004 10:41:47 +0530, "Rakesh Rajan"
<ra**********************@hotmail.com> wrote:
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" <ga****@hotmail.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
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


Nov 16 '05 #4
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.myFo rm_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.

"Gas" <ga****@hotmail.com> wrote in message
news:OF****************@TK2MSFTNGP09.phx.gbl...
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

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris Bruce | last post: by
6 posts views Thread by Gary Miller | last post: by
14 posts views Thread by =?Utf-8?B?UHVjY2E=?= | last post: by
19 posts views Thread by zacks | last post: by
2 posts views Thread by =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.