Home

kill a process on hitting stop button

I have this code:
Process p = Process.GetProcessByName("notepad").FirstofDefault();
if( p == null ) p = Process.Start("notepad.exe");
I wish to kill this p on hitting the stop button, how do I do that? thanks!

Comments

Sign In or Register to comment.