Results 1 to 12 of 12

Thread: Multi Array

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Cool Multi Array

    What do you think of doing an array like this?

    Code:
    redim preserve aData(i)
    aData(i) = array(strTypeSelected, strHTML)

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well, I wouldn't like you very much for implementing that in any project we worked on together... but if it works and takes far less code than the alternative, more to ya...

  3. #3
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046

    Re: Multi Array

    Originally posted by jesus4u
    What do you think of doing an array like this?

    Code:
    redim preserve aData(i)
    aData(i) = array(strTypeSelected, strHTML)
    are those arguments really strings? that might cause some problems ...

  4. #4
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    or is array a function?

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    function

  6. #6
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Well if its a function, I don't understand what you are asking about? All you are doing is assigning a value to an element in an array.

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    You mean something like this:

    VB Code:
    1. Dim iCoords(0) As Variant
    2.  
    3.   iCoords(0) = Array(1, 2)
    4.  
    5.   MsgBox UBound(iCoords(0))

    Pretty interesting, although I couldn't get it to work with anything but Variant.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by nemaroller
    Well if its a function, I don't understand what you are asking about? All you are doing is assigning a value to an element in an array.
    Actually, he's creating a multidimensional array from a one-dimensional array, like in the code I posted above.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    i still dont get the point of the thread ... is there something new or clever there that I am missing?

  10. #10
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by Muddy
    i still dont get the point of the thread ... is there something new or clever there that I am missing?
    I believe he's asking whether or not it's a good method to use, or if he should declare them as multi-dimensional, to which I don't know the answer.

    But then again, I'm not him, so I can only speculate what he's asking.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  11. #11
    New Member
    Join Date
    Apr 2003
    Posts
    11
    You may just want to point an array to a type.

    Type udt_something
    strTypeSelected as string
    strHTML as string
    end type

    dim aData() as udt_something


    aData(i).strTypeSelected = "Something"
    aData(i).strHTML = "HTML String"

  12. #12
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    seems to me that:

    if you were wanting to conserve memory then this might save some (how much depends on how big the array is)

    if you were wanting to conserve processor usage then a 2-d array would save some usage (how much depends on how many times the array is accessed)

    Either way, if it is resource optimization that your after, you would probably be "splitting hairs" worrying about it at all.

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