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 :)

asked Apr 24, 2014 at 20:32
4
  • Have you tried Console.WriteLine(names.InnerText)? Commented 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) Commented 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 :) Commented 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. Commented 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
answered Apr 29, 2014 at 14:24

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.