473,326 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 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 3576
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
6
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
1
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
4
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in one Closing routine he will not be asked again by...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
2
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
I am (still) relatively new to Windows applications, most of my experience has been Web based, and I am confused about what exactly happens when the Main() method is called and how to manipulate...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.