You need to add the Web Browser control
to your Toolbox --
From the menu: Tools - Add/Remove Toolbox Items - COM components tab -
check 'Microsoft Web Browser'

To use it in your program, click on it once it's in your toolbox, and draw it on your form.

The code below shows how to do 'regular' navigation things (go to a website, go Home, go previous, go next, etc.)
Public
Class Form1Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Clickwb1.Navigate(txtURL.Text)
End Sub
Private Sub btnHome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHome.Click
wb1.GoHome()
txtURL.Text = wb1.LocationURL
wb1.Refresh()
End Sub
Private Sub btnBackward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackward.Click
wb1.GoBack()
End Sub
Private Sub btnForward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForward.Click
wb1.GoForward()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wb1.GoHome()
txtURL.Text = wb1.LocationURL
wb1.Resizable = True
wb1.Refresh()
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
If Me.WindowState <> 1 Then
wb1.Width = Me.Width - 100
wb1.Height =
Me.Height - 100End If
End Sub
Private Sub wb1_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles wb1.NavigateComplete2
txtURL.Text = wb1.LocationURL
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
End
End Sub
End
Class
VB6
click HERE to download the .vbp project file
Click HERE to
download the .frm form file including code
Dual Browser - .vbp
.frm
(an exercise in manipulating objects on a
screen dynamically)
Last Updated by DrB on Wednesday, February 18, 2009