# Changing Array Length Problem

• 10-09-2002, 11:28 PM
Damo
Changing Array Length Problem

Hey I have a probelm, I'm have a website that uses a Shopping Cart and in
the code it says that there is a Array Mismatch Etc. I'm not very familiar
with Arrays Etc and I was wondering if someone can tell me how to change
the Array Lengths so I can fix this problem
Thanks Damo
• 10-10-2002, 08:48 AM
Kris Eiben
Re: Changing Array Length Problem
dim myarray(5)
redim myarray(7)
x = 8
redim myarray(x)

"Damo" <superstormtrooperdamo@hotmail.com> wrote in message
news:3da4f3e6\$1@10.1.10.29...
>
> Hey I have a probelm, I'm have a website that uses a Shopping Cart and

in
> the code it says that there is a Array Mismatch Etc. I'm not very

familiar
> with Arrays Etc and I was wondering if someone can tell me how to

change
> the Array Lengths so I can fix this problem
> Thanks Damo

• 10-11-2002, 07:53 AM
ASP learner
Re: Changing Array Length Problem

Use ReDim instead of Dim If you have MSDN installed read up on Arrays.

They are fun! :)

http://java.sun.com/docs/books/tutor...ta/arrays.html
• 10-15-2002, 02:58 PM
Silent K
Re: Changing Array Length Problem

If you need to expand the size of an existing array you have 2 choices:

1) ReDim Preserve MyArray(nNewSize) - The preserve option keeps the data
in the array. Without preserve your new array size is increased, but existing
data is lost. ReDim Preserve easy to code, but it can be expensive (slow),
so you might prefer option 2.

2) Build a new array (for large arrays this is fastest):

Dim NewArray()
ReDim NewArray(nNewSize)
For i = LBound(MyArray) to UBound(MyArray)
NewArray(i) = MyArray(i)
Next

"Damo" <superstormtrooperdamo@hotmail.com> wrote:
>
>Hey I have a probelm, I'm have a website that uses a Shopping Cart and in
>the code it says that there is a Array Mismatch Etc. I'm not very familiar
>with Arrays Etc and I was wondering if someone can tell me how to change
>the Array Lengths so I can fix this problem
>Thanks Damo