How to create a web browser in vb 6.0?
Visual Basic 6.0 does't have built-in support for internet and HTML web browsing. HTML browsing can be accomplished through web browser control, a Microsoft product. You can create a web browser application within minutes using the following step-be-step instructions. This tutorial is intended for beginners / novice in vb language.Tutorial for creating web browser in visual basic 6.0
Step 1:
Create a new Standard Exe project in vb. Go to Project -> Components and select 'Microsfot Internet Controls'. This component contains the web browser control. Tick 'Microsoft Internet Controls' check box and click Ok. A new webbrowser control will be placed on the Toolbox.
Step 2:
Drag the web browser control from the toolbox on to the form, alternatively you can double click the control. A new instance of the control will be placed on the form. Give the control a name you wish. For example, MyBrowser. There are naming conventions for using built-in vb controls. But for third party controls there are no such conventions. Insert a textbox control on the form and give it the name 'txtAddress'. For textbox we use txt as prefix. Set the text property of the text box to 'www.google.com' so get get default web address to google.com. Add a label control and set it's name property to lblAddress and caption property to 'Address'. The 'lbl' is the naming convention used to prefix the label control. Add a command button control and give it the name 'cmdGo' or 'cmdBrowse'. Set its caption property to 'Go' or 'Browse'. We have all done with the design or GUI for our web browser project. Now, on to the step 3.
Step 3:
Now double click the command button. Private Sub cmdBrowse_Click() procedure will be added automatically by vb. Simple write the following code with in the sub procedure.
Private Sub cmdBrowse_Click()
MyBrowser.Navigate txtAddress.Text
End Sub
This is the only code required to open a web page on our new browser. The navigate method of the browser control with web address as its parameter will open the webpage on the specified URL (universal Resource Locator). This is the basic web browser with bare-bone web browsing option.
Setp 4:
We have finished our browser project. To test the project Run the project by pressing F5. Click the Browse button, the google.com home page will open!