Click here to Skip to main content
11,633,454 members (83,028 online)
Click here to Skip to main content

Opening the Internet Browser Programmatically

, 18 Aug 2011 CPOL 3.7K 3
Rate this:
Please Sign up or sign in to vote.
Given below is code for opening the Internet browser programmatically in VB 6 and VB.NET.VB 6Private Declare Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As...

Given below is code for opening the Internet browser programmatically in VB 6 and VB.NET.

VB 6
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
End Sub
VB.NET

This will open the URL in the default browser:

System.Diagnostics.Process.Start("http://www.codeproject.com")

This will open the website in Internet Explorer. Here you have the option to change the browser in your code.

System.Diagnostics.Process.Start("iexplore.exe", "http://www.codeproject.com")

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

thatraja
Web Developer
India India
Programmer | 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*.

* - SCAMP???

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150728.1 | Last Updated 18 Aug 2011
Article Copyright 2011 by thatraja
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid