D.JCode
D.JCode

Reputation: 406

Stop and close all processes after exit

Is there any method to free all of the memory and stop all the related task from the task manager? I used the below code but it just closes the application, and some task like chromedriver is still in the task manager.

private void toolStripButton7_Click(object sender, EventArgs e)
{
    DialogResult x; 
    x = MessageBox.Show("Do You Want to Exit?","Exit",MessageBoxButtons.YesNo);
    if (x == DialogResult.Yes)
    Application.Exit();
}

Upvotes: 0

Views: 173

Answers (1)

yogibaba
yogibaba

Reputation: 40

Using System; .. .. ..

Environment.Exit(0); 0 for Successful process completion.  

Upvotes: 2

Related Questions