473,390 Members | 1,579 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,390 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 3579
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.