Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
in Programming by 66 69 85

I want to close Windows Application in C# after running a specific function completed.

void Mydo 

  // my code

  // here I need to close or exit my application


1 Answer

0 like 0 dislike
by 66 69 85
Best answer

Closing Windows application

To close Windows Application in C#, type the below code


Application.Exit() for close the whole Application!

Closing Specific Form in Windows application

In order to close a specific form in a Windows application using C#, type the below code:


Form.Close() for close specific form!

If you don’t ask, the answer is always NO!