473,386 Members | 1,867 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,386 software developers and data experts.

formClosing event triggers 40 times

Hello Everyone,
Probably a really stupid question but i can't seem to figure it out.

So i have a form and when the x button is clicked i want a certain
method to run. The weird thing is that if i just write a console
message my code executes one time, if i place the method i want to run
in this code instead, it executes 40 times ... i don't get it ..what am
i doing wrong. I should say that i am using VS 2005.
Thanks in Advance!

if (CloseReason.UserClosing == e.CloseReason)
{
try
{
saveImages();
}
catch (Exception ex)
{
MessageBox.Show("Error attempting to save yor
images: exception is " + ex.ToString());
}
}

Dec 11 '06 #1
3 1181
I think saveImages() must be triggerring the close event again...

Thanks
-Srinivas.
erin.sebast...@cowaninsurancegroup.com wrote:
Hello Everyone,
Probably a really stupid question but i can't seem to figure it out.

So i have a form and when the x button is clicked i want a certain
method to run. The weird thing is that if i just write a console
message my code executes one time, if i place the method i want to run
in this code instead, it executes 40 times ... i don't get it ..what am
i doing wrong. I should say that i am using VS 2005.
Thanks in Advance!

if (CloseReason.UserClosing == e.CloseReason)
{
try
{
saveImages();
}
catch (Exception ex)
{
MessageBox.Show("Error attempting to save yor
images: exception is " + ex.ToString());
}
}
Dec 11 '06 #2
OMG .. Duggi,
Thank you... the very last line of the method was this.close(). I can't
believe how ridiculous I can be sometimes...
Thanks so much!

Dec 11 '06 #3

Afterall, "experience" is the name we give to our mistakes...

Thanks
-Srinivas.

er************@cowaninsurancegroup.com wrote:
Hello Everyone,
Probably a really stupid question but i can't seem to figure it out.

So i have a form and when the x button is clicked i want a certain
method to run. The weird thing is that if i just write a console
message my code executes one time, if i place the method i want to run
in this code instead, it executes 40 times ... i don't get it ..what am
i doing wrong. I should say that i am using VS 2005.
Thanks in Advance!

if (CloseReason.UserClosing == e.CloseReason)
{
try
{
saveImages();
}
catch (Exception ex)
{
MessageBox.Show("Error attempting to save yor
images: exception is " + ex.ToString());
}
}
Dec 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mats-Lennart Hansson | last post by:
Hi, I'm having a problem with event handlers. My code looks (a bit simplified) like this: public class Listener { CallerClass Call = new CallerClass(); string data= ""; public Listener()
2
by: Nelson | last post by:
Here is the discussion that is already discussed that I am looking for. After visiting the link below I am getting the following code. My question is in which client side script event I can set the...
1
by: e_man_online | last post by:
Hi, I have a VStudio 2003 project that had code like: Private Sub frmAnyForm_Closing(<parameters list...>) Handles MyBase.Closing and this project was converted to .NET 2.0 Everything...
4
by: Academic | last post by:
I read the Help and some of the many Google hits I got but can't find out the difference between MyBase.Closing and MyBase.FormClosing Can anyone tell me? Thanks
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
0
by: r0cboff | last post by:
Hi there, This is my first time posting in here and I'm hoping somebody can point out where I am going wrong? I am currently trying to use Bitemporal tables. By this I mean a table with a valid...
3
by: SimonG via AccessMonster.com | last post by:
Hi, I would like to be able to compare a control's new value with its old value, whenever it is changed by a user. The control holds a numeric value, qty_Sold, when this value changes I need to...
8
by: AAaron123 | last post by:
If I show a form with ShowDialog and Dispose it FormClosing does not appear to run. At least I think that is true. If I want FormClosing and FormClose to run am I suppose to call the forms...
2
by: Anthony P. | last post by:
Hello Everyone, I'm writing an application that will reside in the system tray once it is configured. The application also has an exit button called, creatively, ExitButton. I'm in a bit of a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.