October 14th, 1999, 12:58 PM
Is there any easy way to make array one size:) biger? without using loop or redim?
|
Click to See Complete Forum and Search --> : How to expand array? October 14th, 1999, 12:58 PM Is there any easy way to make array one size:) biger? without using loop or redim? October 14th, 1999, 04:05 PM you can use variant datatype... Dim vntTest As Variant vntTest(0) = 1 vntTest(1) = "test" Sky1000 October 14th, 1999, 07:45 PM The variant datatype cannot be used as you described. If you want to resize an array, it must be declared as a dynamic array. Then it can be appropriately redimensioned. Dim MyDynamicArray() 'Variant datatype is the default ReDim MyDynamicArray(10) If the Option Base is set to 0, the default, the array items will be numbered 0 to 9. If later in your code you want to add values but do not want to lose the contents of the array you can use the Preserve keyword ... ReDim Preserve MyDynamicArray(15) October 14th, 1999, 09:17 PM Sky, what do you mean by "I can't use the Variant method"? I am using it right now and I have no problem with it. Your way would work too but before you issue a redim statement, you need to save your existing data to a temporary array because it will destroy everythings you have in that array... codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |