VBS question: 2D arrays?

Results 1 to 2 of 2

Thread: VBS question: 2D arrays?

  1. #1
    Jason Guest

    Default VBS question: 2D arrays?

    How do you create 2D arrays in VBS? I tryed...<BR><BR>sedanMarket = array(array(.1,.15,.18), array(.07,.10,.14), array(.05,.08,.12))<BR>session("v9") = sedanMarket(0, 0)<BR><BR>and got:<BR><BR>Subscript out of range: &#039sedanMarket&#039 <BR><BR>Anyone know how to do this?<BR>-jason

  2. #2
    Join Date
    Dec 1969

    Default RE: VBS question: 2D arrays?

    Unfortunately, there is no way to create a preinitialized 2-D array in VBS. <BR><BR>HOWEVER...<BR><BR>What *you* have created with<BR>&nbsp;&nbsp;&nbsp;&nbsp;sedanMarket = array(array(.1,.15,.18), array(.07,.10,.14), array(.05,.08,.12))<BR>is an ARRAY OF ARRAYS!<BR><BR>And, so, you could get what you want thus:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;session("v9") = sedanMarket(0)(0)<BR><BR>That is equivalent to doing:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;oneRow = sedanMarket(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;session( "v9") = oneRow(0)<BR><BR>but you don&#039t need the intermediate temporary variable.<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