Error with Split Function
Hi Guys,
I am trying to split a string of integers but I keep getting this error:
Index was outside the bounds of the array.
Here is my code:
VB Code:
Public Shared Function picastopoints(ByVal sTemp)
'For example sTemp could equal 6p10
Dim whole, remainder, convert, strInt
whole = Split(sTemp, "p", -1, 0)
strInt = whole(0)
remainder =whole(1)
convert = strInt * 12000 + remainder * 1000
Return convert
End Function
Please Please Help..I dont know what I am doing wrong..:confused:
Thanks!
Re: Error with Split Function
Here try this :)
VB Code:
Public Shared Function picastopoints(ByVal strTemp As String) As Integer
Dim strWhole() As String, intNum1 As Integer, intRemainder As Integer, intConvert As Integer
strWhole = Split(strTemp, "p")
intNum1 = CInt(strWhole(0))
intRemainder = CInt(strWhole(1))
intConvert = intNum1 * 12000 + intRemainder * 1000
Return intConvert
End Function