two dimension array

Results 1 to 3 of 3

Thread: two dimension array

  1. #1
    Join Date
    Dec 1969

    Default two dimension array

    When I want to create a two dimension array I know that I would do it like this<BR><BR>dim myarray(2,2)<BR><BR>but what I don&#039;t remember is what is the row and what is the column when I&#039;m declaring it? So if I did this<BR><BR>dim myArray(4,20)<BR><BR>would that be 4 rows and each has 20 columns or fields or would it be 20 rows that each have 4 columns or fields? Thanks.

  2. #2
    Join Date
    Dec 1969

    Default one other question

    When I&#039;m using the ubound function on a two dimensional array, let&#039;s say I do this<BR><BR>dim myarray(4,20)<BR>for i = 0 to ubound(myarray)<BR><BR>should it go to 4 or to 20? I&#039;ve also seen it done like this.<BR><BR>for i = 0 to ubound(myarray,2)<BR><BR>What is the difference in the output here? I&#039;m having a hard time understanding this, so any explanations would be greatly appreciated.

  3. #3
    Eddie Campbell Guest

    Default RE: one other question

    In answer to your 1st question, it really doesn&#039;t matter<BR>dim myArray(4,20)<BR>or<BR>dim myArray(20,4)<BR><BR>as long as your data fits into the array it makes no real difference which way round you refer to it.<BR><BR>Regarding Ubound, UBound(MyArray) will return the number of items in the first array dimension whereas Ubound(MyArray,2) will return the second dimension<BR><BR>eg<BR>dim myArray(4,20)<BR>Ubound(MyArray) will return 4<BR>Ubound(MyArray,2) will return 20<BR><BR><BR>

Posting Permissions

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