Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array width?
Message
 
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00519394
Message ID:
00519923
Vues:
14
Joe,
I didn't realize from your post that you wanted the number of array dimensions. IAC, according to the help, 60 is the maximum number of dimensions you can specify in a Dim statement so you don't need to use 32000. < s >

>>How to find out an arrays width?
>>Finding the length/records is done but what about the width/number of elements?
>>
>>I am sure I have missed a very simple function somewhere...
>
>Hopefully there is a more elegant solution than what I have done here, but I had to move forward on this I am still hopefull. :)
>
>
>' **************************************************************
>' GetArrayWidth: This function Return the width of array elements
>'     Author: Joe Johnston 6/14/2001
>'     Parameters: aArray - Array to be checked
>' **************************************************************
>Public Function GetArrayWidth(aArray) as integer
>    Dim i As Integer, x
>    'Dim aArray(3, 1 To 10, 1 To 15, 25) ' for testing
>
>    On Error Resume Next  ' dont stop on error
>    For i = 1 To 32000    ' 32000 max should more than enough
>                          '   didn't Bill Gates say something
>                          '   similar about 640K ??
>        x = UBound(aArray, i)            ' a call might work here
>        If Err.Number = 9 Then Exit For  ' wait for the overflow
>    Next i
>
>    GetArrayWidth = (i - 1)  ' return the last good value
>End Function
>
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform