Problem: i made a basic web-browser and i got it all to work except the URL bar... if i type something in and hit GO it works... but i want it to automatically tell me the URL of the website i'm on...
the code i have tried was...
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = (WebBrowser1.Url.ToString)
End Sub
solution:
Private Sub Navigate(ByVal address As String)
If String.IsNullOrEmpty(address) Then Return
If address.Equals("about:blank") Then Return
If Not address.StartsWith("http://") And _
Not address.StartsWith("https://") Then
address = "http://" & address
End If
Try
WebBrowser1.Navigate(New Uri(address))
Catch ex As System.UriFormatException
Return
End Try
End Sub
Private Sub webBrowser1_Navigated(ByVal sender As Object, _
ByVal e As WebBrowserNavigatedEventArgs) _
Handles WebBrowser1.Navigated
TextBox1.Text = WebBrowser1.Url.ToString()
End Sub
:p

