Address Bar Problem (Possible Solution)

Hello everyone,

I'm still working on this browser of mine and What I'm trying to do I thought would have been a very simple thing but as usual, it's just turning out to be a big frustration. Especially when you're a newbbie.

I'm using the AxWebBrowser on a form in VS 2003 to create this browser. The things that I've done so far are working fine. What I need to do now is make the TextBox I'm using as the Address bar change its text according to the http address the browser is at at the time. When I type an URL in there now and click the go button it works fine but if I click on a link in a page, the address bar text doesn't change to reflect the new url I'm at now. Now I've read from all over the place and the only thing that's done is get me a little more confused on the subject and definitely more frustrated. Can anyone help me out here and tell me how I can go about making this happen Please. (He says with a big sigh!)




Answer this question

Address Bar Problem (Possible Solution)

  • chris99

    Unfortunately, I use Visual Basic 2005 Express so the instructions will not be 100% correct but they should work just fine.

    Here is what you do:

    1. Go to the code page for your browser control and your address bar.
    2. Near the top, you'll get a dropdown that should say (General). Choose the name of your browser control in this list.
    3. To the right, there should be another dropdown that should say (Declarations). Select Navigated in this list and a new Private Sub should appear.

      Private Sub WebBrowser_Navigated(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser.Navigated

      End Sub

      It should look a bit like the code above.
    4. insert this code before End Sub: Address.Text = WebBrowser.Url.AbsoluteUri
    5. It should now look a bit like the following:

      Private
      Sub WebBrowser_Navigated(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser.Navigated

      Address.Text = WebBrowser.Url.AbsoluteUri

      End Sub

    Note: Address should be replaced by the name of your Address Bar and WebBrowser should be replaced by the name of your browser control. I have made them red for easy identification. These are the instructions for VB2005 Express and may be different for Visual Studio 2003


  • Çetin Yaşar

    No problem.

    I'm also making a VB browser and I had this issue myself where the address bar wouldn't change. I then discovered actions for controls (e.g. TextBox Changing) and thought I could try see if there is an appropriate browser action.


  • zeroXML

    Hi Terry,

    Have you got to your favorites yet And if so care to share what you've done for those The only thing that I've come up with is the SaveFileDialog but I'm still working on getting it to save the right type of files. lol Everything else about it seems to work fine though. Maybe it's because it's 11:05 PM over here and I've been on this since 7:00 AM. Guess it's time to go to bed. @-)



  • Slavochka

    Hello Terry,

    I want to thank you very much. I'm always amazed at how really easy another's point of view can make. lol Sometimes too much information is not good from all sides is not good.

    For those that might be using the same as me this is the code that ended up working for me. (Which is exactly the same as what Terry shown me, except for a few changes in the code.)

    Private Sub AxWebBrowser_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser.NavigateComplete2

    URL_Address.Text = AxWebBrowser.LocationURL

    End Sub

    Thanx again Terry :-)



  • Address Bar Problem (Possible Solution)