Gorkfu
New member
- Joined
- Oct 22, 2008
- Messages
- 3
- Programming Experience
- 3-5
I am new to VB.net, I've only been messing with it for a few weeks. However I'm not new to coding, been an avid php coder for the last few years. Anyways on to my issue. 
I found some code written for VB6 for extracting text within tags. I took it and modified it for VB.net, not much was needed to be modified. I ended up with the following code.
The code works fine if I have the strict option off, however I'm in the habit of leaving it on and want to keep that habit. 
With option strict on I get an error, "Option Strict On disallows late binding." If I understand correctly it means I can't bind an array or part of an array to a variable with option strict on.
Error shows up on these lines:
ExtractIt = lArray(1)
ExtractIt = lArray(0)
How do i change the arrays to work properly with "Option Strict On"?
Original code can be found here:
Extract Text Within Tags
I found some code written for VB6 for extracting text within tags. I took it and modified it for VB.net, not much was needed to be modified. I ended up with the following code.
VB.NET:
Public Function ExtractIt(ByVal TextIN As String, Optional ByVal StartTag As String = " ", Optional ByVal EndTag As String = " ") As String
On Error GoTo LocalError
Dim lArray As Object
ExtractIt = ""
lArray = Split(TextIN, StartTag)
If IsArray(lArray) Then
ExtractIt = lArray(1)
lArray = Split(ExtractIt, EndTag)
If IsArray(lArray) Then
ExtractIt = lArray(0)
Else
ExtractIt = ""
End If
End If
Exit Function
LocalError:
ExtractIt = "Didn't Work!"
End Function
With option strict on I get an error, "Option Strict On disallows late binding." If I understand correctly it means I can't bind an array or part of an array to a variable with option strict on.
Error shows up on these lines:
ExtractIt = lArray(1)
ExtractIt = lArray(0)
How do i change the arrays to work properly with "Option Strict On"?
Original code can be found here:
Extract Text Within Tags
Last edited: