Results 1 to 4 of 4

Thread: Dynamic Array

  1. #1
    Guest

    Dynamic Array

    I need a simple dynamic array for strings in a sub.
    I want to add a string value to the array and later on the sub read the array. I know how to read from the array but how do you add.

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606

    Lightbulb -------->

    Code:
    Dim myarray() as string
    redim preserve myarray(new_size) as string
    myarray(new_size-1)= "string"
    preserve will keep your previous value,if not use
    your previous value will be gone!!!

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    that would make the array contain a nullstring at myarray(new_size)

    Well you could redimension without having a counter
    Code:
    Redim preserve myarray(ubound(myarray)+1)
    myarray(ubound(myarray))="String"
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest

    Smile Thanks!!

    Works like a charm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width