Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quesiton on Dimensioning an Array
#3
Not sure I'm seeing a difference. When I print the upper and lower bounds I'm getting exactly the boundaries I Dimensioned in the arrays. The IDE allows the dimensioning of Array2(1 to 1) and it appears I'm getting the same result if it was simply Dimensioned Array2(1). Here an example:

Dim Array1(1 To 0)
Dim Array2(1 To 1)
Dim Array3(0 To 1)

Print LBound(Array1)
Print UBound(Array1)
Print
Print LBound(Array2)
Print UBound(Array2)
Print
Print LBound(Array3)
Print UBound(Array3)
Print
Print
x = 5
y = 9
z = x + y
For i = 1 To 10
    For ii = 1 To 15
        If i = 1 And ii = 1 Then
            Array2(i) = x + y
            Print Array2(ii)
        End If
    Next
Next

Print
Array2(1) = z
Print
Print Array2(1)

In my actual program I am working with a re-dimensional array ... so something like Array2(1 to n). The thing with n though it is coming up with values of zero and 1, so I'm trying to come up with code to deal with this eventuality. I'm thinking along the lines of a Select Case to capture n. The zero is crashing but (1 to 1) seems to be accepted.
Reply


Messages In This Thread
Quesiton on Dimensioning an Array - by Dimster - 02-05-2024, 04:30 PM
RE: Quesiton on Dimensioning an Array - by bplus - 02-05-2024, 06:51 PM
RE: Quesiton on Dimensioning an Array - by Dimster - 02-05-2024, 08:59 PM



Users browsing this thread: 1 Guest(s)