// For Start Button
public void MyAction1()
{ // Code Here }
// For Exit Button function
public void MyExit1()
{
Thread thrd1 = new Thread(() => MyAction1());
thrd1.Abort();
}