title: GUI Winform and ending /killing process
body: <p>I have a c# GUI app and it's running a bunch of command line process one after another. How do I end/kill the app while the command line process is running?
  I have an Exit button (button 3)  but it's not working if the process called is still running.</p>
  
  <pre><code>private void Run_Process(string process_to_run, string p_arg)
      {
          Process myProcess = new Process();
          richTextBox1.AppendText("\nRunning " + process_to_run);
  
          try
          {
              myProcess.StartInfo.UseShellExecute = false;
              myProcess.StartInfo.FileName = process_to_run;
              myProcess.StartInfo.Arguments = p_arg;
              myProcess.StartInfo.CreateNoWindow = true;
              myProcess.Start();
              myProcess.WaitForExit();
              richTextBox1.AppendText("...Success");
              time_date = get_time();
              log_file.Write(time_date);
              log_file.WriteLine(process_to_run + "...Success");
  
          }
  
          catch (Exception ep)
          {
              richTextBox1.AppendText("\n" + ep.Message);
              time_date = get_time();
              log_file.Write(time_date);
              log_file.WriteLine(process_to_run + "...Failed. ERROR: " + ep.Message);
          }
      }     
  
    private void button3_Click(object sender, EventArgs e)
      {
          db.connection.Close();
          Application.Exit();
      }
  </code></pre>