This is an example of what I use in VB2008
It checks the url in my.settings.enteredURL
If it is a bad URL then it navigates the web browser on my form to http:\\www.google.com otherwise it navigates to the URL that it checked.
Code:
Sub updateURL()
Dim URL As String
Dim httpCheck As String = UCase(My.Settings.enteredURL)
'Make sure URL starts with http
If httpCheck.StartsWith("HTTP:\\") Or httpCheck.StartsWith("HTTP://") Then
URL = My.Settings.enteredURL
Else
URL = ("http://" & My.Settings.enteredURL)
End If
Try
Dim myWebClient As System.Net.WebClient = New System.Net.WebClient()
Dim myStream As System.IO.Stream = myWebClient.OpenRead(URL)
Dim myStreamReader As System.IO.StreamReader = New System.IO.StreamReader(myStream)
Dim s As String = myStreamReader.ReadToEnd
myStreamReader = Nothing
myStream = Nothing
myWebClient = Nothing
Catch
URL = "http:\\www.google.com"
End Try
webbrower1.Navigate(New Uri(URL))
End Sub
Hope This Helps!