Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking an HTML from within the a Visual Basic program

Status
Not open for further replies.

Faheemi

Programmer
Sep 2, 2001
59
HK
Hi there,

I am very new to VB. I want to open an HTML page when I click a button in a visual basic form. Please help me understand how to get this done.

Thanks a lot.

Faheem Hameed
 
Hi Faheem,

This is easier that you think.

Add the Microsoft Internet Controls to your project.

Draw a WebBrowser to a form.

then add the following to the form's module.

Private Sub Form_Load()
WebBrowser1.Navigate "End Sub

That should get you started.
 
Hi comaboy,

Thanks for your answer. But what I actually wanted to do is that I want to open a HTML page directly in Internet Explorer or Netscape (default browser) when I click a button in the VB form.

Thank you for your help.

Faheem Hameed


 
Option Explicit

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 Command1_Click()
Dim sLink As String

sLink = "thread222-168356
Call ShellExecute(0&, "Open", sLink, vbNullString, vbNullString, vbNormalFocus)
End Sub
 
Hi JustinEzequiel and comaboy,

Thanks a lot. Both of your solutions worked great.

Hameed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top