Results 1 to 4 of 4

Thread: declare and use a multi-dimension array?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    How would I delcare and use a multi-dimension array?

    I know how to use a single dimension:

    Code:
    Dim sArray() as string
    
       sArray(0) = "Hello World!"
    
       MsgBox sArray(0)
    But what I would like to do is something like:

    "Hello Dan" or "Hello John", etc... How would you declare this array and how would you call out the location of the array to get Dan or John?

    Any help would be appreciated..

    DAn

    Dan

  2. #2
    Guest
    Like this:
    Code:
    Dim sArray(2, 2) As String
    Then you can store things like this
    Code:
    sArray(0, 0) = "Hello John"
    sArray(2, 1) = "Hello Dan"
    sArray(0, 2) = "Hello Jane"
    
    etc.

  3. #3
    Member ElectroTism's Avatar
    Join Date
    Jan 2000
    Posts
    38

    or

    Dim Stuff(0 to X, 0 to Y) as WHATEVER
    where x and y are integers and whatever is variable type



  4. #4
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    If I understand you correctly

    I don't think you are after a multi-dimensioned array. If you are, then the previous posts have answered that for you.

    I think you want two arrays. One for names, and one for salutations perhaps.

    Names
    Dan
    John
    ...

    Salutations
    Hello
    Gidday
    Bye
    Ciao
    ...

    If you actually want every combination possible to be stored in an array - Then this is when a multi-dimensional array would be of use to you because then you will be able to get to any combination by knowing the index number of the name and of the salutation (i.e. the order you filled the array in).

    Post back if you need more help and someone will clarify...

    Regards
    Paul Lewis

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