Hi,

I'm back to a vbscript asp project after a couple of years doing php. I
used to be pretty good at vbscript, but i'm rusty.

I have a spreadsheet that figures shipping costs. the rows are weight
values. The columns are zones. The data is the cost to ship.

weight, z1, z2, etc.
1, 5, 8
2, 8, 10

etc.

I can't find any examples of how to actually populate the arrays in the
code. Everyone wants to put dynamic data into arrays, but I have all my
data, and I don't mind typing it all into the code.

help?

thanks

--
Joel Goldstick

Re: how to populate a multidimentional array in vbscript by Yevgen

Yevgen
Thu Sep 09 23:40:46 CDT 2004

..I am not sure if I understood your question right ... But if I did, it
should be like this ....

Dim MyArray(5, 5)
MyArray(0, 0) = 1
MyArray(0, 1) = 5
....
MyArray(4, 4) = 18

....But it's ugly ....:) ....

"jcg" <joel@rent-heritage.com> a écrit dans le message de
news:opsd20rud9iog2az@msnews.microsoft.com...
| Hi,
|
| I'm back to a vbscript asp project after a couple of years doing php. I
| used to be pretty good at vbscript, but i'm rusty.
|
| I have a spreadsheet that figures shipping costs. the rows are weight
| values. The columns are zones. The data is the cost to ship.
|
| weight, z1, z2, etc.
| 1, 5, 8
| 2, 8, 10
|
| etc.
|
| I can't find any examples of how to actually populate the arrays in the
| code. Everyone wants to put dynamic data into arrays, but I have all my
| data, and I don't mind typing it all into the code.
|
| help?
|
| thanks
|
| --
| Joel Goldstick



Re: how to populate a multidimentional array in vbscript by Operator

Operator
Fri Sep 10 09:37:38 CDT 2004

Hi,

I am New! and trying to learn VBScript and was just covering the topic in
question. Here is an example:
**************Start of Script*********************
Option Explicit

Private Const LAST_NAME = 0
Private Const FIRST_NAME = 1
Private Const PHONE = 2

Private astrPhoneList ()

FillPhoneList
DisplayPhoneList

Sub FillPhoneList

ReDim astrPhoneList (PHONE, 4)

astrPhoneList (LAST_NAME, 0) = "Williams"
astrPhoneList (FIRST_NAME, 0) = "Tony"
astrPhoneList (PHONE, 0) = "404-985-6328"

astrPhoneList (LAST_NAME, 1) = "Carter"
astrPhoneList (FIRST_NAME, 1) = "Ron"
astrPhoneList (PHONE, 1) = "305-781-2514"

astrPhoneList (LAST_NAME, 2) = "Davis"
astrPhoneList (FIRST_NAME, 2) = "Miles"
astrPhoneList (Phone, 2) = "212-963-5314"

astrPhoneList (LAST_NAME, 3) = "Hancock"
astrPhoneList (FIRST_NAME, 3) = "Herbie"
astrPhoneList (PHONE, 3) = "616-752-6943"

astrPhoneList (LAST_NAME, 4) = "Shorter"
astrPhoneList (FIRST_NAME, 4) = "Wayne"
astrPhoneList (PHONE, 4) = "853-238-0060"

End Sub

Sub DisplayPhoneList

Dim StrMsg
Dim lngIndex
Dim lngUBound

lngUBound = UBound (astrPhoneList, 2)
strMsg = "The phone list is:" & vbNewLine & vbNewLine
For lngIndex = 0 to lngUBound
strMsg = strMsg & astrPhoneList (LAST_NAME, lngIndex) & ", "
strMsg = strMsg & astrPhoneList (FIRST_NAME, lngIndex) & " : "
strMsg = strMsg & astrPhoneList (PHONE, lngIndex) & vbNewLine
Next

MsgBox strMsg

End Sub
*************End of Script******************

Hope this helped.

-Operator



"Yevgen Lazaryev" <how_inventive_spammers_are@nospam.usa> wrote in message
news:ubQJbBvlEHA.1904@TK2MSFTNGP09.phx.gbl...
> ..I am not sure if I understood your question right ... But if I did, it
> should be like this ....
>
> Dim MyArray(5, 5)
> MyArray(0, 0) = 1
> MyArray(0, 1) = 5
> ....
> MyArray(4, 4) = 18
>
> ....But it's ugly ....:) ....
>
> "jcg" <joel@rent-heritage.com> a écrit dans le message de
> news:opsd20rud9iog2az@msnews.microsoft.com...
> | Hi,
> |
> | I'm back to a vbscript asp project after a couple of years doing php. I
> | used to be pretty good at vbscript, but i'm rusty.
> |
> | I have a spreadsheet that figures shipping costs. the rows are weight
> | values. The columns are zones. The data is the cost to ship.
> |
> | weight, z1, z2, etc.
> | 1, 5, 8
> | 2, 8, 10
> |
> | etc.
> |
> | I can't find any examples of how to actually populate the arrays in the
> | code. Everyone wants to put dynamic data into arrays, but I have all my
> | data, and I don't mind typing it all into the code.
> |
> | help?
> |
> | thanks
> |
> | --
> | Joel Goldstick
>
>