Changing Array Length Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Changing Array Length Problem

Hybrid View

  1. #1
    Damo Guest

    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

  2. #2
    Kris Eiben Guest

    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




  3. #3
    ASP learner Guest

    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

  4. #4
    Silent K Guest

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center