Hi fellow vb-ers,
I'm trying to extract the text between:
<label for=field_1> and </label>
I have captured the HTML into a string using the webbrowser control, and am using the following function to try and get the text within the tag:
However, this code will not work, if I use <label for=field_1> as the first string and </label> as the second... I'm a n00b to visual basic, can anybody help me out please?Code:Public Function midReturn(ByVal first As String, ByVal last As String, ByVal total As String) As String If last.Length < 1 Then midReturn = total.Substring(total.IndexOf(first)) End If If first.Length < 1 Then midReturn = total.Substring(0, (total.IndexOf(last))) End If Try midReturn = ((total.Substring(total.IndexOf(first), (total.IndexOf(last) - total.IndexOf(first)))).Replace(first, "")).Replace(last, "") Catch ArgumentOutOfRangeException As Exception End Try End Function




Reply With Quote