我希望TextBox
显示Web浏览器当前所在的网页的URL。下面显示的代码似乎无法解决我的问题。
通过调用TextBox
导航到上一页时,WebBrowser1.GoBack()
不会改变
衷心感谢您的帮助!
我已经尝试过了:
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = WebBrowser1.Url.ToString()
End Sub
答案 0 :(得分:1)
使用WebBrowser的Navigated事件获取其当前URL。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WebBrowser1.GoBack()
End Sub
Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
TextBox1.Text = e.Url.ToString
End Sub