Reputation: 330
How do I get the value from a HTML string using VB.NET?
<p style="text-align: center; margin: 0px">
<span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold">
This is the text I want to catch!!!
</span>
</p>
Upvotes: 0
Views: 1991
Reputation: 14771
1- Turn the span to a server object:
<span ID="span1" runat="server"> .... </span>
2- InnerText property to get the text reside inside the span between > and < :
Dim str as string = span1.InnerHTML
Upvotes: 0
Reputation: 498914
Use an HTML parser such as the HTML Agility Pack.
It can parse both full documents and document fragments and let you query these using XPath like syntax.
The source download comes with many example projects.
Upvotes: 3