VB version here.

You can use the .NET Process class to close an external application. First you must create a Process object that represents the application. You can then call Kill on that Process to force the application to close. That's the only way to close applications that don't have a GUI but, for those that do, it's better to call CloseMainWindow first and only call Kill as a last resort. It's like the difference between just throwing someone out and asking them to leave first. CloseMainWindow gives the application a chance to clean up before exiting, while Kill just removes it from memory. E.g.
csharp Code:
  1. private void CloseProcessesByName(string processName)
  2. {
  3.     foreach (Process p in Process.GetProcessesByName(processName))
  4.     {
  5.         // Ask nicely for the process to close.
  6.         p.CloseMainWindow();
  7.  
  8.         // Wait up to 10 seconds for the process to close.
  9.         p.WaitForExit(10000);
  10.  
  11.         if (! p.HasExited)
  12.         {
  13.             // The process did not close itself so force it to close.
  14.             p.Kill();
  15.         }
  16.  
  17.         // Dispose the Process object, which is different to closing the running process.
  18.         p.Close();
  19.     }
  20. }
The process name is what gets displayed in Windows Task Manager.

NOTE: Code converted using Instant C# by Tangible Software Solutions.