<strong>142</strong>
Obtaining the value between two tags
Page 1 of 15 Replies - 329 Views - Last Post: 11 August 2012 - 09:52 AM
#1
Obtaining the value between two tags
Posted 10 August 2012 - 11:53 AM
Hi everyone! I am trying to get the value between the two tags below and put that value into a textbox.
Replies To: Obtaining the value between two tags
#2
Re: Obtaining the value between two tags
Posted 10 August 2012 - 11:59 AM
Use regex.
It occurred to me that while you might not have furnished any of the bits that make it easier for us to help you - like what you have tried, your code so far, etc - that I could go a bit above and beyond and give you some links..
http://www.dreaminco...g-a-web-spider/
http://msdn.microsof...y/az24scfc.aspx
It occurred to me that while you might not have furnished any of the bits that make it easier for us to help you - like what you have tried, your code so far, etc - that I could go a bit above and beyond and give you some links..
http://www.dreaminco...g-a-web-spider/
http://msdn.microsof...y/az24scfc.aspx
#3
Re: Obtaining the value between two tags
Posted 10 August 2012 - 12:32 PM
If it is XML or XHTML, then use an XML approach.
Dim theTag = <strong>142</strong> Console.WriteLine( theTag.Value )
#4
Re: Obtaining the value between two tags
Posted 11 August 2012 - 07:12 AM
AdamSpeight2008, on 10 August 2012 - 12:32 PM, said:
If it is XML or XHTML, then use an XML approach.
Dim theTag = <strong>142</strong> Console.WriteLine( theTag.Value )
I know how to do this but what I have been trying to do is find the two strong tags in an html document and then take out the number, because the number will not always be 142. I have tried parsing the html and inserting an id in to the strong tag, that didnt work. I have no idea in the world how to use regex. So im just plain stuck.
#5
Re: Obtaining the value between two tags
Posted 11 August 2012 - 08:41 AM
You are not stuck - you need to read up on regex and implement it. It's not that bad.
#6
Re: Obtaining the value between two tags
Posted 11 August 2012 - 09:52 AM
Ok I am trying a different approach. I set the page to text only and now the html is as follows:
I used this code to try to get the number 142, but it didnt work:
<a href="/camrymps/followers/" class="selected">
142
</a>
I used this code to try to get the number 142, but it didnt work:
Dim allelements As HtmlElementCollection = WebBrowser1.document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("class") = "selected" Then
TextBox2.AppendText(webpageelement.ToString)
End If
Next
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|