- Joined
- Apr 12, 2004
- Messages
- 1,101
- Reaction score
- 0
I am trying to create a back button for a web browser.. I know there are controls I could use instead of doing it this way, but right now I'm just trying to learn how to do things my own way.
webbrowser2 = Upon loading a new page, sets the value backlink.text to the value of "number" then sets the value of "number" to the URL of the current page, updating the value of "number"
button2 = the back button, makes webbrowser2 navigate to the URL which is stored as backlink.text
number = a variable which is set to the url of webbrowser2
backlink = is set equal to the value of "number"
Also, I was trying to make the address in the text field update itself the the url of the current page every time a new page was loaded (see webbrowser2 section).
For some reason, this code doesn't want to work (it compiles fine, just doesn't work the way I want it to). That's where I need some advice. can someone shed some light as to why this isn't working?
Source:
Also note, this is my first project with VB.
webbrowser2 = Upon loading a new page, sets the value backlink.text to the value of "number" then sets the value of "number" to the URL of the current page, updating the value of "number"
button2 = the back button, makes webbrowser2 navigate to the URL which is stored as backlink.text
number = a variable which is set to the url of webbrowser2
backlink = is set equal to the value of "number"
Also, I was trying to make the address in the text field update itself the the url of the current page every time a new page was loaded (see webbrowser2 section).
For some reason, this code doesn't want to work (it compiles fine, just doesn't work the way I want it to). That's where I need some advice. can someone shed some light as to why this isn't working?
Source:
Code:
Public Class Form1
Dim number
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
lasttyped.Text = address.Text
WebBrowser2.Navigate(address.Text)
End Sub
Private Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
backlink.Text = number
number = WebBrowser2.Url
address.Text = number
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser2.Navigate(backlink.Text)
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser2.Navigate(lasttyped.Text)
End Sub
End Class
Also note, this is my first project with VB.