Given below is code for opening the Internet browser programmatically in VB 6 and VB.NET.
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub btnWebsite_Click()
ShellExecute Me.hwnd, "open", "http://www.codeproject.com/", _
vbNullString, vbNullString, vbNormal
This will open the URL in the default browser:
This will open the website in Internet Explorer. Here you have the option to change the browser in your code.
Programmer | CodeProject MVP, Mentor | Author | Geek | Blogger | Bachelor | Dude
About him & his blog? check out here
. Currently he's updating the site, he'll return soon there with more things*
In Codeproject, he posted a blogpost
& more than couple of Tip/Tricks
, hope he'll write more soon.
Favorite techs are MVC, WCF, Mobile, HTML5, CSS3, jQuery, etc.,
His hobbies are watching movies, CP, being alone, etc., But now he's working on something*