tags:

views:

364

answers:

2

I've got a WinForms app in which I have the need to refer the user to a web page with documentation/help. I realize the LinkButton would get the trick done, but what I want is a standard Button control to launch the system default browser when that button is clicked. The only reference code I've got for this references the Win32 API, hooking the ShellExecute command:

ShellExecute(Me.Handle.ToInt32, "Open", "http://www.stackoverflow.com/", CStr(0), CStr(0), WindowStyle.SW_MAXIMIZE)

Does anyone else know how to do this in a "proper and pure" dotnet way?

+6  A: 
System.Diagnostics.Process.Start("http://www.website.com")

should work

TJMonk15
Awesome -- thank you!!!
Parvenu74
A: 

Remember to wrap that call in a Try...Catch block for Win32Exception. Firewall software like ZoneAlarm allow users to cancel the page opening which will cause an "An error occurred in sending the command to the application" exception.

Robert Venables