I have a tabbed web browser its working fine , but i have a little problem and that is if i open a new tab is ok but if i go back to previous tab the urltextbox it have the url in the tab last opened tab.
so i am asking you for help if you have the solution

Recommended Answers

All 2 Replies

Hi

You could use the SelectedIndexChanged event of the TabControl to then find the the WebBrowser control on that tab page and read its Url property. Something like:

Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged

    'Grab the Web Browser control on this tab and read its URL property
    'NOTE, only expect to get one browser control.
    For Each wb As WebBrowser In TabControl1.SelectedTab.Controls.OfType(Of WebBrowser)()
        urlTextBox.Text = wb.Url.ToString
    Next

End Sub

The above does assume that you would only have one WebBrowser control on each TabPage. There are other ways of finding the WebBrowser control if this is not the case.

HTH

thank you very much you helped me so much i wish the best for you bro

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.