-1

Okay, so I have a HTML list of items which I want to use as an autocomplete source for my VB application. However I can't seem to strip the HTML out of the string. The HTML list is as follows:

    <option value="0001">String example 1</option>
    <option value="0002">String example 2</option>
    ...

Can anyone advise a way of just getting the content out of a huge list like that? I was thinking about just reading the text file line by line and extracting the content from the HTML, but I've never worked with HTML in VB before and I'm not sure how to do it... I figured something like the below would work, I'm just not sure how to ask VB for the content only.

Any help would be greatly appreciated.

        Dim objFSO = CreateObject("Scripting.FileSystemObject")
        Dim objFile = objFSO.OpenTextFile(My.Computer.FileSystem.SpecialDirectories.Desktop & "\test2.txt", 1)

        Do Until objFile.AtEndOfStream
            txtLine = objFile.ReadLine

            'Get content of line here.

            'Add content to new string.  
        Loop
user3516240
  • 365
  • 1
  • 6
  • 25
  • Possible duplicate of [How do you parse an HTML in vb.net](https://stackoverflow.com/questions/516811/how-do-you-parse-an-html-in-vb-net) – wp78de Nov 24 '17 at 21:40

1 Answers1

0

Use the HtmlAgilityPack library to load the HTML, traverse over the document and extract needed data. site:http://html-agility-pack.net

wp78de
  • 18,207
  • 7
  • 43
  • 71
Kieran Devlin
  • 1,373
  • 1
  • 12
  • 28