What is the equivalent of End
(VB6/VBA) in order to end an application using C#?
In C#, EndsWith() is a string method. This method is used to check whether the ending of the current string instance matches with a specified string or not. If it matches, then it returns the string otherwise false. Using “foreach” loop, it is possible to check many strings.
Just Close() all active/existing forms and the application should exit.
There's no with keyword in C#, like Visual Basic. So you end up writing code like this: this. StatusProgressBar.
The marked answer is not correct. Application.Exit() is a graceful shutdown, it can be blocked by a form's FormClosing event handler setting e.Cancel = true. The exact equivalent to the VB End statement is Environment.Exit(0);
To terminate Windows Forms application use:
Application.Exit();
To terminate a console application you must return the main function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With