Re: fixed or dynamic array
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 16:51:31 -0000
"George Hester" <hesterloli@xxxxxxxxxxx> wrote in message
news:eVUMKiakIHA.980@xxxxxxxxxxxxxxxxxxxxxxx
I have the following in a VB program:
Dim aList
aList = Split(sList, ";", -1, vbTextCompare)
My question is aList a dynamic or fixed array?
It is a dynamic array. However, it is not a standard dynamic array of strings. It is actually held in a Variant because you did not specify the required variable type when you declared the variable aList, and it therefore defaulted to being a Variant. Variants can occasionally be quite useful, and they are perfectly capable of holding all sorts of things, including arrays, but in general they are to be avoided unless you have a specific need for one. The fact that your own array is in a Variant will significantly slow things down when the rest of your code deals with it. You would be far better off using a standard dynamic String array, which you can do simply by changing the declaration to:
Dim aList() as String
Mike
.
- Follow-Ups:
- Re: fixed or dynamic array
- From: Peter T
- Re: fixed or dynamic array
- References:
- fixed or dynamic array
- From: George Hester
- fixed or dynamic array
- Prev by Date: Re: Feedback/ Change request
- Next by Date: Re: Some label controls appear black on some computers
- Previous by thread: Re: fixed or dynamic array
- Next by thread: Re: fixed or dynamic array
- Index(es):
Relevant Pages
|