Web Browser

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
2 posts Page 1 of 1
Contributors
MANSQN
VIP - Donator
VIP - Donator
Posts: 159
Joined: Sat Sep 17, 2011 11:33 pm

Web Browser
MANSQN
This tutorial will show you how to make a web browser;

1 Click on Project next to Create:
2 Click on Windows Form Application, and name the project "Your name's Application" and then click Ok.

You can change the form text to "your name's web browser". Click on the form and then go to properties window, then change the text property.

In the properties window, change the WindowState property to Maximized so that when the user launch the web browser, it will be maximized:

3 Add a Webbrowser from the toolbox.

Change the dock property

4 Right click on the webbrowser and click on properties. In the properties window change the Anchor property to Top, Bottom, Left, Right as follows:

5 Adjust the size of the webbrowser on the form, and leave a space between the webbrowser and the controlbox of the form:

6 Let's first assign the home page of the webbroser. The home page is the first page that appears when the Web Browser is loaded.

To do that, right click on the webbrowser and click on properties.

Change the property of URL to your favorite website:

7 Add two buttons to the form and place them between the form's header and the web browser. Change the text for each button to << and >> :

The button that text is << will do the Back command:

8 Double click on the button and the following code:
Code: Select all
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

WebBrowser1.GoBack()

End Sub
The button that text is >> will do the Forward command:

9 Double click on the button that text is >> and add the following code:
Code: Select all
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

WebBrowser1.GoForward()
10 Add a Label next to the 2 buttons and change the text to Address:

Add a text box and place it next to the Label:

11 Right click on the textbox and click on properties. In the properties window, change the anchor property to Top, Left, Right. The reason we do that is because when the web browser size changes by the user, the address bar's size will change too.

12 Add a button and place next to the textbox and change it's text to Go:

13 Change the Go button anchor property to Top, Right:

14 Double click on Go button and add the following code:
Code: Select all
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

WebBrowser1.Navigate(TextBox1.Text)

End Sub
15 Add another 2 buttons and change their text to Home and Refresh;

16 Change the 2 buttons anchor property to Top, Right:

17 Double click on Home button and add the following code:
Code: Select all
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

WebBrowser1.GoHome()

End Sub
18 Double click on refresh button and add the following code:
Code: Select all
rivate Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

WebBrowser1.Refresh()
Run your web browser and it should work fine.
User avatar
Code
VIP - Donator
VIP - Donator
Posts: 51
Joined: Sun Sep 18, 2011 7:25 pm

Re: Web Browser
Code
Dude seriously? Why would you re post something that was posted before you....
viewtopic.php?f=38&t=7251
viewtopic.php?f=17&p=54101#p54101
Image
Image
Image
2 posts Page 1 of 1
Return to “Tutorials”