Re: array size
- From: "Kelly Ethridge" <kelly@xxxxxxxxxxxxxxxxx>
- Date: Thu, 9 Jun 2005 14:11:24 -0700
The only problem with getting the pointer to a SafeArray descriptor generically
through dereferencing the array pointer out of the Varaint, as in the method shown
in your link, is that passing an uninitialized array of objects or UDTs will cause the
array to be initialized to a zero element array. So the example code will always
return 1 for the number of dimensions of an uninitialized array of objects or UDTs.
"Norm Cook" <normcookNOSPAM@xxxxxxxxxxxx> wrote in message news:%23MCydNPbFHA.2756@xxxxxxxxxxxxxxxxxxxxxxx
> 1. What's wrong with error checking or keeping a boolean flag?
>
> 2. You missed the link in Mike's google page:
> http://vbnet.mvps.org/index.html?code/helpers/getarraydims.htm
> This code not only determines whether or not the array is initialized
> but also gives the number of dimensions. Note, however, that
> even that code has to do an If call,
> If address <> 0 Then
> which is just another form of error checking.
>
> 3. How about
> Dim A() as whatever
> ReDim A(0)
> Now it is dynamic & you can resize it, check its bounds, etc
>
> "sali" <sali@xxxxxxxxxxx> wrote in message
> news:O0F6KZObFHA.724@xxxxxxxxxxxxxxxxxxxxxxx
>> "Mike D Sutton" <EDais@xxxxxxxx> wrote in message
>> news:ufUpEXNbFHA.1456@xxxxxxxxxxxxxxxxxxxxxxx
>> > [Ignore previous post..]
>> >
>> >> "dim arr()"
>> >> to have dynamic aray, and after sometimes
>> >> "redim arr(some_size)"
>> >> but then, to check the current size with
>> >> "ubound(arr)"
>> >> gives error if arr is not yet "redimed"
>> >>
>> >> is it possible to check for empty array [no one element] *without*
> having
>> >> to
>> >> catch errors?
>> >> [and without auxilary variable to hold "not-yet-redim"]
>> >
>> > Try this:
>> >
> http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/946e66e23a0010f5
>> > Hope this helps,
>>
>> thanks, but unfortunately, it uses error catching [on error resume next]
>>
>> isn't it little bit unusual not to have *built in* tool for complete
>> variable handling?
>>
>> or, are there some advices to use "dictionary object" or "collection" [or
>> something else] for representing dynamic data structures that tends to be
>> sometimes "empty"?
>> maybe the collection is the best candidate, because it employes access by
>> numeric index as well?
>>
>>
>>
>
>
.
- Follow-Ups:
- Re: array size
- From: Tony Proctor
- Re: array size
- References:
- array size
- From: sali
- Re: array size
- From: Mike D Sutton
- Re: array size
- From: sali
- Re: array size
- From: Norm Cook
- array size
- Prev by Date: Re: Is There ??
- Next by Date: Re: Is There ??
- Previous by thread: Re: array size
- Next by thread: Re: array size
- Index(es):
Relevant Pages
|