C#: Opening external applications

Created 22 August 2001 00:00
Opening files from within your application that you do not want to handle within the application itself is really simple using the System.Diagnostics namespace.

Eg: to open the user's default browser to a web site:

  try 
  {
    System.Diagnostics.Process.Start("http://yoursite.com");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open the user's mail client to send mail to someone:

  try 
  {
    System.Diagnostics.Process.Start("mailto: [email protected]");
  }
  catch (Exception) 
  {
    // error handling
  }

Eg: To open a gif file:

  try 
  {
    System.Diagnostics.Process.Start("C:/YourFile.gif");
  }
  catch (Exception) 
  {
    // error handling
  }