after i copy the link by this code.

Dim myElement As HtmlElement = browser.Document.ActiveElement
Dim target As String = myElement.GetAttribute("href")

how i can i open new window in a tabbed browser with that link.
i did it in different ways but it not working, and here is one of tries.

    Dim browser As wbf = Me.TabControl1.SelectedTab.Tag
    Dim myElement As HtmlElement = browser.Document.ActiveElement
    Dim target As String = myElement.GetAttribute("href")
    Dim nw As New swb
    nw.Show()
    browser.Navigate(target)

swb=form1 and wbf = class called web browser function

Hi

It's a bit difficult to say how you might achieve this without seeing your code for the wbf class and swb.

However, if this was just a simple form with a browser control and you wanted to open another instance of the form with the Url set to the first link found in the displayed document, then the following would work:

Dim myElement As HtmlElement = WebBrowser1.Document.ActiveElement
Dim target As String = myElement.Children(0).GetAttribute("href")
Dim nw As New Form1
nw.Show()
nw.WebBrowser1.Navigate(target)

However, the above assumes that there is only one link on the page so it is not ideal. Do you have some other means of getting the address, such as an ID for the link that you are interested in?

HTH

i havent webbrowser1 in my form but i have a class that inherit web browser like this

Public Class wbf
    Inherits WebBrowser
end class

so how i make my new window web browser open the target

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.