0

Hey guys ! This is on what I'm working on :

 Dim url As String = "http://brayket.byethost9.com/index.php?/shoutbox/"
    Dim web As New HtmlWeb()
    Dim doc As HtmlDocument = web.Load(url)
    Dim names As HtmlNodeCollection = doc.DocumentNode.SelectNodes("//span[@class='shoutbox_text']")
    Console.WriteLine(names)
    System.Threading.Thread.Sleep(100000000)

I'd like to write on the console everything that's between "<span class="shoutbox_text">" and </span> Hope I'll find some help here :)

4
  • Have you tried Console.WriteLine(names.InnerText)? Apr 24, 2014 at 21:20
  • @MarcusRickert I don't have the possibility I know that it works because if I do console.writeline(names.count) it shows the right amount of span class"shoutbox_text" in the html code. But I can't manage to show what are these classes >< (By the way, I'm using HtmlAglityPack)
    – Keytrap
    Apr 24, 2014 at 22:30
  • I've managed to make it work ! This is what I've done : codeDim web As New HtmlWeb() Dim doc As HtmlDocument = web.Load(url) Dim row = doc.DocumentNode.SelectNodes("//tr[@class=""row2""]") for each xName in row console.writeline(xName.innertext)code And it works :)
    – Keytrap
    Apr 26, 2014 at 21:24
  • @Niiw - could you post your solution as an answer, then accept it? That way the solution will be more clear to others with the same problem.
    – Kate Paulk
    Apr 29, 2014 at 11:35

1 Answer 1

0
 Dim url As String = "http://brayket.byethost9.com/index.php?/shoutbox/"
    Dim web As New HtmlWeb()
    Dim doc As HtmlDocument = web.Load(url)
    Dim names As HtmlNodeCollection = doc.DocumentNode.SelectNodes("//span[@class='shoutbox_text']")

'**Place the code below to read each values between selected nodes.**

For Each useAnyWantedWordHere in names
console.writeline(userAnyWantedWord.InnerText & vbcrlf)
Next
Console.ReadLine()

If you want to make it work with a textbox or richtextbox this is the code :

For Each AnyWantedWord in names
richtextbox1.AppendText(AnyWantedWord.InnerText & vbCrLF)
Next

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.