Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
How To Use the WebBrowser Control from Visual Basic 5.0
This article was previously published under Q162719
Microsoft Internet Explorer 3.0 includes a custom ActiveX control called
"WebBrowser." When you use WebBrowser in combination with Microsoft Visual
Basic 5.0, you can design powerful custom solutions that include Internet
Web browsing features. This article illustrates how to use the WebBrowser
control within Microsoft Visual Basic 5.0.
The following example creates a mini-browser:
- Create a new Standard .exe project in Microsoft Visual Basic 5.0. Form1
is added automatically.
- On the Project menu, click Components.
- Select the Microsoft Internet Controls component. Click OK.
- Add the following controls to Form1:
Control Name
-------------- ---------
Text Box Text1
Command Button Command1
WebBrowser WebBrowser1
- In Form1's code window, add the following code:
Option Explicit
Private Sub Command1_Click()
If Text1.Text <> "" Then
WebBrowser1.Navigate Text1.Text
If WebBrowser1.Visible = False Then
WebBrowser1.Visible = True
End If
End If
End Sub
Private Sub Form_Load()
Me.Width = 5325
Me.Height = 5400
Me.Caption = "Mini browser"
With WebBrowser1
.Visible = False
.Width = 4575
.Height = 3375
.Top = 600
.Left = 240
End With
With Text1
.Top = 240
.Left = 1680
.Height = 285
.Width = 3135
.Text = "http://www.microsoft.com"
End With
With Command1
.Top = 120
.Left = 240
.Height = 375
.Width = 1215
.Caption = "Navigate"
.Default = True
End With
End Sub
- On the File menu, click Save Project1.
- On the Run menu, click Start.
When you click Navigate, the WebBrowser appears and automatically loads the
URL displayed in the TextBox.
NOTE: Distribution of a Microsoft Visual Basic 5.0 application that uses
the WebBrowser control requires that Microsoft Internet Explorer 3.0 (or
later) be installed on the target system prior to installation.
For additional information, please see the following article in the
Microsoft Knowledge Base:
155969
(http://kbalertz.com/Feedback.aspx?kbNumber=155969/EN-US/
)
: How To Distribute the WebBrowser Control
Article ID: 162719 - Last Review: July 13, 2004 - Revision: 2.1
APPLIES TO
- Microsoft Visual Basic 5.0 Control Creation Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
Retired KB Content DisclaimerThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate