0

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>

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

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.