formClosing event triggers 40 times

  • Thread starter Thread starter erin.sebastian
  • Start date Start date
E

erin.sebastian

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());
}
}
 
I think saveImages() must be triggerring the close event again...

Thanks
-Srinivas.
 
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!
 
Afterall, "experience" is the name we give to our mistakes...

Thanks
-Srinivas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top