Gary Ray
GRAY at utah.gov
Tue Jun 17 14:50:02 CDT 2003
There is an event handler discussion for the close event here:
http://www.dotnet247.com/247reference/msgs/19/98033.aspx
Gary Ray - Application Developer
Workforce Information Systems R & D
E-Mail gray at utah.gov
>>> chizotz at charter.net 06/17/03 10:53AM >>>
How do you exit a Windows forms application gracefully?
private void menuItemFileQuit_Click(object sender,
System.EventArgs e)
{
DialogResult myResult;
myResult = MessageBox.Show("Are you sure you want to quit
?","Polybags Tracking",MessageBoxButtons.YesNo ,
MessageBoxIcon.Question);
if (myResult == DialogResult.Yes)
{
this.Close();
Application.Exit();
}
}
Which works fine when the user plays nice and uses my Quit
menu item. What I'm having trouble figuring out is how to
handle when the user clicks on the close 'X' button, or
uses the control box or alt-F4 to exit the program. I have
put the Application.Exit(); in the formMain_Unload,
formMain_Close, etc events and the event never fires. I
can't find anything about this in the help files, on the
MS site, or in the two thick books on C# I have. Its
frustrating, because in VB this is pretty simple to do.
Any help out there?
Thanks,
Ron
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/dba-vb/attachments/20030617/dd1251dc/attachment-0003.html>