|
-
Jan 6th, 2005, 03:35 PM
#1
Thread Starter
Addicted Member
parse(0) = <Subscript out of range> ??[solved]
Hi.
What can i do to prevent this from happen?
Code:
parse = Split(lstNowWarn.List(l), ":")
numbers = parse(0)
names = parse(1)
errors:
parse(0) = <Subscript out of range>
parse(1) = <Subscript out of range>
Big Thanks,
naitsabes
Last edited by naitsabes85; Jan 6th, 2005 at 04:34 PM.
-
Jan 6th, 2005, 03:46 PM
#2
Hyperactive Member
Re: parse(0) = <Subscript out of range> ??
Check how many splits were created:
VB Code:
Dim Splits As Long
Splits = UBound(Parse) - LBound(Parse) + 1
If Splits > 0 Then Numbers = Parse(0)
If Splits > 1 Then Names = Parse(1)
-
Jan 6th, 2005, 04:11 PM
#3
Re: parse(0) = <Subscript out of range> ??
bpd is correct. FYI, if the string you are trying to split is an empty string (""), the Split function will set the UBound of the resulting array to -1.
I would do it similar to this:
VB Code:
If lstNowWarn.List(l) <> "" then
parse = Split(lstNowWarn.List(l), ":")
numbers = parse(0) ' you get at least this
If UBound(parse) > 0 Then
names = parse(1)
End If
End If
"It's cold gin time again ..."
Check out my website here.
-
Jan 6th, 2005, 04:34 PM
#4
Thread Starter
Addicted Member
Re: parse(0) = <Subscript out of range> ??
thanks guys, i try this.
naitsabes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|