Page 1 of 2
stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 2:08 am
by lesan101
I want my label3.text to say the number in the red circle below:
offcourse, this is the number for pikachu, so for every pokemon i search
it will show me there number.
but how would it be possible if it does not have an "id"
btw this is on Visual Basic
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 3:02 am
by Snyper345
try adding () around it?
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 3:21 am
by lesan101
Snyper345 wrote:
try adding () around it?
where? you need to be more detailed -_-
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 9:02 am
by Agust1337
Probable like this, tho I am not good at html lol
Code: Select all <th>Natioal №</th>
<td><strong>(025)</strong></td>
I think this is what Snyper means.
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 10:14 am
by bisnes_niko
If you can already grab the html file, then I would do it something like this:
First scan all lines of the html (This way doesn't work incase the <td><strong>25</strong></td> isn't in the beginning)
If the line is starting with the td and strong, make a new variable with that line content
Now, make the variable replace all <td> and <strong> (don't forget the </> ones)
This would make it just be the number
Hope that helped someway... I'm currently at my work and cannot provide any code lol
Edited: Fixed some words...
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 12:38 pm
by lesan101
Hmm, your idea might seem to work, since thats the number with a "strong" around it, so i guess it should be easy to scan
but yeah, after work please try to see if you can find the version of what your talking about : )
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 1:18 pm
by mandai
You can use this:
Code: Select all Dim elements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("strong")
Label3.Text = elements(0).InnerText
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 1:26 pm
by lesan101
mandai wrote:
You can use this:
Code: Select all Dim elements As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("strong")
Label3.Text = elements(0).InnerText
Mandai you are awesome !
i would of never thought about that -__-
but thank you : ))
but lets say it wouldn't have a "strong" around it.. lets say it was this:
Code: Select all <th>Gender</th>
<td><span class="gender-male">50% male</span>,
<span class="gender-female">50% female</span></td>
</tr>
how would i display the "50%male" part in a label ?
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 2:03 pm
by mandai
You can use similar code to the above, just change it to GetElementsByTagName("span").
Re: stupid HTML you suck ! HELP PLZ
Posted: Thu Feb 24, 2011 4:52 pm
by lesan101
mandai wrote:
You can use similar code to the above, just change it to GetElementsByTagName("span").
I fiqured it was something like that
but the thing is, "span" is used for the once. so how would i get it to find the right "span" ??
is it possible to locate it by line ?