0

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

2
Contributors
2
Replies
13
Views
1 Year
Discussion Span
Last Post by scomx
0

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

0

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

Edited by scomx

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.