Simple Web Browser
This is a basic tutorial, progress bars and graphics will added to a new tutorial at a later date.
Tips
- Dock any buttons at the top left, at the top left.
- Dock any buttons at the top right, at the top right.
- Dock the top textbox at the top left and right.
- Dock the web browser, top left, right and bottom
Steps
- Add the following
- 5 buttons - Go, Stop, Refresh, Back, Forward
- 1 web browser
- 1 textbox
Place the Back and Forward buttons at the top left of the form next to each other.
Place the textbox to the right of them
Place the Go, Stop, Refresh buttons to the right of the textbox.
Set the dock for the top left buttons to Top, Left.
This keeps the buttons at the top left of the form.
Set the dock for the textbox to Top, Left and Right.
This extends the textbox when you resize the form.
Set the dock for the top right buttons to Top, Right.
This keeps the buttons at the top right of the form.
Set the dock for the webbrowser to Top, Bottom, Left and Right.
This resizes the web browser to the size of the form.
Paste the following code into your code.
Full Source
[hide=10][vb]Public Class Form1
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.Navigate(TextBox1.Text)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.Refresh()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Stop()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoForward()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.GoBack()
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
TextBox1.Text = WebBrowser1.Url.OriginalString
End Sub
End Class
[/vb][/hide]
Enjoy