I want to close my application from one button, does any one knows how to do it??
like in visual basei you use
VB Code:
End
thanks
Printable View
I want to close my application from one button, does any one knows how to do it??
like in visual basei you use
VB Code:
End
thanks
Application.Close()
It doesn´t works :( I wrote Application.Close(); also I try with the name of the name of the application in this case is "Sale" so I wrote Sale.Close(); and It didn´t works either, could you help me??, or maybe you know a way to reload an application.
Cheers
Try this
Me.Close()
What do you mean it didn't work ? the code DevGrp posted should work regardless of where it is used (startup form or nested form)Quote:
Originally posted by angel of dark
It doesn´t works :( I wrote Application.Close(); also I try with the name of the name of the application in this case is "Sale" so I wrote Sale.Close(); and It didn´t works either, could you help me??, or maybe you know a way to reload an application.
Cheers
angel of dark: You don't need to use the name of the application. Just use "Application.Close();" No matter the name. "Sale.Close()" will never work.
This will work if "Sale" is the startup form of the project .Quote:
Originally posted by Tec-Nico
"Sale.Close()" will never work.
True, but I know the case, and "Sale" is the name of the project, not the name of the startup form, Pirate. :p
"Application.Close()" won't work on other forms... But I found out that "Application.Exit()" does.
So I wrote on the Closed event "Application.Exit()" and it forces the End of your application like "End" of Visual Basic.
Example:
private void frmLogin_Closed(object sender, System.EventArgs e)
{
Application.Exit();
}
Application.Exit() will close your application, but if you have any running threads they will continue to run, this doesn't take care about threads. But that's true in VB too...
Hope this helps.
Application.Close closes the application but still runs in the background
Application.Exit closes and exits the application....I am sure that if there are threads still running then a threadAbortException will be thrown which you would have to handle....
I am sure if there are threads still running they will continue to run if you don't stop them programatically.Quote:
Originally Posted by Techno
Did you look at the last post date in this thread before posting?Quote:
Originally Posted by zahadumy
05-24-2003
Oops... I just saw 05.24, which would be like a week ago in this year, I didn't look at the year. Anyway, I thought I found this thread on the first page, probably I was searching for something else and found it. Sorry.