tags:

views:

63

answers:

2

Hi

What is the equivalence of End (vb6) when we wanna to end an application using c#?

+4  A: 

To terminate Windows Forms application use:

Application.Exit();

To terminate a console application you must return the main function.

Ciwee
I would believe that `Environment.Exit` is closer to the VB.NET `End` statement.
Fredrik Mörk
+2  A: 

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);

Hans Passant
thank you nobugz
odiseh