chiali ong
0
Q:

how to close an application in c#

Application.Exit();
2
this.Close();
//This only close the current form or window that you are using.
1
Process[] runningProcesses = Process.GetProcesses();
foreach (Process process in runningProcesses)
{
    // now check the modules of the process
    foreach (ProcessModule module in process.Modules)
    {
        if (module.FileName.Equals("MyProcess.exe"))
        {
            process.Kill();
        } else 
        {
         enter code here if process not found
        }
    }
}
0
application.Exit();
-1

New to Communities?

Join the community