Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:53:54+00:00 2026-05-30T18:53:54+00:00

I have just used htmlagilitypack to extract all link as htmlnode from an html

  • 0

I have just used htmlagilitypack to extract all link as htmlnode from an html document, but i need this returned from my function as htmlelement

Dim Tags As HtmlNodeCollection = docNode.SelectNodes(strXpath)
  Dim ListResult As New List(Of HtmlElement)
  For Each Tag As HtmlNode In Tags
     ListResult.Add(Tag.Element)
 Next
Return Nothing

How can i do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:53:55+00:00Added an answer on May 30, 2026 at 6:53 pm

    I suspect the only way to do it is to create HtmlElement, and then copy attributes and inner HTML from HtmlNode.

    Here is an extension method for this; it accepts a reference to a System.Windows.Forms.HtmlDocument instance to create a new HtmlElement:

    <System.Runtime.CompilerServices.Extension> _
    Public Shared Function ToHtmlElement(node As HtmlNode, doc As System.Windows.Forms.HtmlDocument) As HtmlElement
        Dim element = doc.CreateElement(node.Name)
        For Each attribute As HtmlAttribute In node.Attributes
            element.SetAttribute(attribute.Name, attribute.Value)
        Next
        element.InnerHtml = node.InnerHtml
    
        Return element
    End Function
    

    And to use it you could like this:

    Dim browser As New WebBrowser()
    browser.Navigate("about::blank")
    
    Dim Tags As HtmlNodeCollection = docNode.SelectNodes(strXpath)
      Dim ListResult As New List(Of HtmlElement)
      For Each Tag As HtmlNode In Tags
         ListResult.Add(Tag.ToHtmlElement(browser.Document))
     Next
    Return Nothing
    

    But please note, I’m not too familar with VB.NET, I created code examples for C# first and then translated them to VB,NET.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just downloaded SQL Server 2005 express edition from here: To be used
I have just taken over some code and I see this used a lot.
I have just used proguard, but classes I am trying to instantiate via reflection
So far I have just used Spring beans that are singletons but now I
Have just installed Aptana and used MacPorts to update all the extras for a
I have just installed django-cnotes But it wont work. It just throws up this
I have used just Windows for programming so far. Now, I have an internship
Just trying to understand that - I have never used it before. How is
I have just used the ScrollToFixed plugin by bigspotteddog ( https://github.com/bigspotteddog/ScrollToFixed ) on my
I have just used FastMM4 to detect leaks. I did not realise our application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.