CODE ARCHIVE

Years of coding.

Technical articles, programming tutorials, code snippets and source files shared over the years.

Back to all articles

ARTICLES

How to extract text content from tags in VB.Net

With this simple vb.net function You are able to extract content from HTML tags, useful and smart Max :)

Public Function GetTagContent(ByRef html As String, ByVal start_tag As String, ByVal end_tag As String) As String
Dim s As String = ""
 Dim content() As String = html.Split(start_tag)
 If content.Count > 1 Then
 Dim parts() As String = content(1).Split(end_tag)
 If parts.Count > 1 Then
 s = parts(0)
 End If
 End If
 Return s
End Function