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


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.