School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,360 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,732 people online right now. Registration is fast and FREE... Join Now!




Create a Simple Web Browser

 
Reply to this topicStart new topic

> Create a Simple Web Browser, only 4 buttons and 1 textbox

Rating  3
firebolt
Group Icon



post 23 Mar, 2009 - 11:23 PM
Post #1


I will show you how to create a simple web browser in VB6. This web browser is very self explanatory but the steps are shown. Once loaded Visual Basic, follow these steps.

1.Create a new project, and then go to "Project" on the menu.
Click components or use the shortcut Ctrl+T

2.Find the component "Microsoft Internet Controls," check it and click "Apply" and then "Close."

3.Click the icon that was just added in the tools window, and draw a large sized window with it but big enough to add in a few buttons and textboxes. This is going to be where you view web pages through your browser.

4.Make a text box; this will be your URL bar where you type in the address of the website you want to see. (You may also create a heading or such)

5.Make four command buttons, these are going to be your Go, Back, Forward, and Refresh buttons, change the captions accordingly, and name each of them Cmdgo, Cmdback, CmdForward, and CmdRefresh. Place them in appropriate positions and now we code.

Firstly we will code the back button.
CODE

Private Sub cmdback_Click()
WebBrowser1.GoBack
End Sub



Then we will code the Forward button which has a similar code to the back button.
CODE

Private Sub Cmdforward_Click()
WebBrowser1.GoForward
End Sub



Now we give the code to the Go button. This will link to the text box as when we click the button, the URL within the text box will open up.
CODE

Private Sub cmdgo_Click()
WebBrowser1.Navigate (Text1.Text)
End Sub



This will refresh the page and reload it.
CODE

Private Sub cmdrefresh_Click()
WebBrowser1.Refresh
End Sub



Double click the form and type the WebBrowser part in. This is for the homepage (Google is my default)
CODE

Private Sub Form_Load()
WebBrowser1.Navigate ("http://google.com")
End Sub



This changes the text box's text into what URL that you're currently at, and the next line makes the caption of your form into the header of the URL.
CODE

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Text1.Text = (WebBrowser1.LocationURL)
Form1.Caption = (WebBrowser1.LocationName)
End Sub


So now it should look like (or similar) like image attached.


Attached thumbnail(s)
Attached Image
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

_VB125
*



post 1 Oct, 2009 - 03:39 AM
Post #2
what about an advanced web browser or something of the sort?
Go to the top of the page
+Quote Post

firebolt
Group Icon



post 1 Oct, 2009 - 04:13 AM
Post #3
That was definitely an option, however, Microsoft will end support to VB6 so that would mean most of these VB6 tutorials will serve a little part of this community, and so the main focus will be at VB.NET and future versions.
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/7/09 07:48PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month