|
-
May 26th, 2005, 03:03 PM
#1
Thread Starter
Addicted Member
For Next Statement - Until end or array?? {Solved}
Hi, im guessing this answer is very simple so sorry for the easy question, I just for some reason couldn't find the answer.
All I want to do is go through an array until you hit the last index, if that makes any sense. I have an array which could have any amount of indexes..
So I want to do something like this:
VB Code:
Private Sub CheckStatus()
Dim Checks() As Integer
Dim CellText As String
CellText = DetailsGrid.CellText((llRow - 2), 5)
Checks() = Split(CellText, "; ")
For Checks() = 1 To Last
' Do whatever..
Next
End Sub
So what could I do to find out the last index of an array? Im sure you could use LBound and UBound to do it but I have never used them before. Thanx all for the help!
Last edited by epod69; May 26th, 2005 at 03:22 PM.
-
May 26th, 2005, 03:06 PM
#2
Re: For Next Statement - Until end or array??
this should do it
dim ArrayLength as integer
arraylength = ubound(checks())
for i = 1 to arraylength
or
for i = 1 to arraylength - 1
I dont really remember which :/
-
May 26th, 2005, 03:20 PM
#3
Re: For Next Statement - Until end or array??
The best way would be:
For I = LBound(strArray()) To UBound(strArray())
Next I
because that will work wether the array is zero based, or anything else.
-
May 26th, 2005, 03:20 PM
#4
Thread Starter
Addicted Member
Re: For Next Statement - Until end or array??
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
|