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
575 views
in Programming by 42 68 83

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 42 68 83
 
Best answer

Closing Windows application

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

 Application.Exit()

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:

FormName.Close()

Form.Close() for close specific form!

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