Hi, how to avoid the WebBrowser in Vb.net to go at specific website, then return to specific link

Here the code I try, but got an error,expression does not produce value

Here the code

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If WebBrowser1.Navigate("http://www.youtube.com") Then


        End If

    End Sub


Does the user have a place where s/he will enter the address or the browser retrieve the URL somewhere? If the user is the one entering the URL then you can simply check the entered address and if its youtube address then instruct WebBrowser to browse to that other address.

Also please capture and post here the error so we can see, also another thing is that before you can start doing anything with WebBrowser you need to start by this code:

  On Error Resume Next

  ' This should solve your problem.
  If WebBrowser1.Url.PathAndQuery.Equals("http://www.youtube.com") Then
 ' MsgBox("You have entered youtube website.")
 ' MsgBox("Other address entered")
 End If

Hope that will answer your question.