|
-
Aug 4th, 2002, 12:53 PM
#1
Thread Starter
Addicted Member
Getting the Ubound from a second or third dimension
I have a three dimensional array, but the the second and third dimensions are all different sizes.
like:
anArray(0,0 to 8)
anArray(1,0 to 12)
When you say Ubound(anArray), it would return 1 (for this case). But say I want to get the second dimension Ubound for each of the first dimensions?
this doesn't work (as far as i know): ubound(anArray(0)) (under my assumption this would return 8, but like i said, it doesn't work).
Please tell me something that does work.
thanks,
jmiller
-
Aug 4th, 2002, 01:00 PM
#2
Frenzied Member
VB Code:
Dim anArray(0,0 to 8)
Dim anOtherArray(1,0 to 12)
'Syntax is Ubound(Variable,Dimension) or Lbound(Variable,Dimension)
Debug.Print Ubound(anArray,1) 'Returns 0
Debug.Print LBound(anArray,1) 'Returns 0
Debug.Print UBound(anArray,2) 'Returns 8
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Aug 4th, 2002, 01:10 PM
#3
Need-a-life Member
UBound Function
Returns aLong containing the largest available subscript for the indicated dimension of anarray.
Syntax
UBound(arrayname[, dimension])
The UBound function syntax has these parts:
Part Description
arrayname Required. Name of the arrayvariable; follows standard variable naming conventions.
dimension Optional; Variant (Long). Whole number indicating which dimension's upper bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.
Remarks
The UBound function is used with the LBound function to determine the size of an array. Use the LBound function to find the lower limit of an array dimension.
UBound returns the following values for an array with these dimensions:
Dim A(1 To 100, 0 To 3, -3 To 4)
Statement Return Value
UBound(A, 1) 100
UBound(A, 2) 3
UBound(A, 3) 4
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 4th, 2002, 01:36 PM
#4
Thread Starter
Addicted Member
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
|