extract text

astradamasta

Registered Member
Joined
Nov 24, 2008
Messages
56
Reaction score
8
i have been programming in vb6 for about 4 years. i'm changing over to vb 2008. I'm trying to extract user names from my webbrowser...i have been trying to use the getelementbyid and i havent had any success..here is a part of the html code:

href="/user/Justin" >Justin</a></span></div>
href="/user/Shannon" >Shannon</a></span></div>
href="/user/Jessica" >Jessica</a></span></div>
href="/user/Johnny" >johnny</a></span></div>

how could i extract these usernames?? i want to extract justin, shannon, jessica, and johnny. thanks in advance
 
Put that into TextBox1 and add a ListBox, then try this:

Code:
Dim Lines() As String = TextBox1.Text.Split(vbCrLf)
        For Each Line As String In Lines
            Dim fullstring As String = Line
            Dim split1() As String
            Dim split2() As String
            split1 = fullstring.Split("/")
            split2 = split1(2).Split(Chr(34))
            ListBox1.Items.Add(split2(0))
        Next
 
Last edited:
A more efficient way of doing it is to do is straight from the web browser.

Try:

Dim lnk as htmlelement
For each lnk in webbrowser1.document.getelementbytype("a")
Listbox1.items.add(lnk.innertext)
Next

Your listbox would then contain:

Justin
Shannon
Jessica
Johnny

You're probably scanning Youtube or a similar site for usernames right?


i have been programming in vb6 for about 4 years. i'm changing over to vb 2008. I'm trying to extract user names from my webbrowser...i have been trying to use the getelementbyid and i havent had any success..here is a part of the html code:

href="/user/Justin" >Justin</a></span></div>
href="/user/Shannon" >Shannon</a></span></div>
href="/user/Jessica" >Jessica</a></span></div>
href="/user/Johnny" >johnny</a></span></div>

how could i extract these usernames?? i want to extract justin, shannon, jessica, and johnny. thanks in advance
 
Back
Top