Posted By

pckujawa on 10/24/08


Tagged

url link browser c uri csharp


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
ddevening
vali29


How to start the default internet browser programmatically by using Visual C-Sharp


 / Published in: C#
 

URL: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q305703

  1. string target= "http://www.microsoft.com";
  2. //Use no more than one assignment when you test this code.
  3. //string target = "ftp://ftp.microsoft.com";
  4. //string target = "C:\\Program Files\\Microsoft Visual Studio\\INSTALL.HTM";
  5.  
  6. try
  7. {
  8. System.Diagnostics.Process.Start(target);
  9. }
  10. catch
  11. (
  12. System.ComponentModel.Win32Exception noBrowser)
  13. {
  14. if (noBrowser.ErrorCode==-2147467259)
  15. MessageBox.Show(noBrowser.Message);
  16. }
  17. catch (System.Exception other)
  18. {
  19. MessageBox.Show(other.Message);
  20. }

Report this snippet  

You need to login to post a comment.