Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multi-dimensional ArrayList in VBScript (using .NET framework): is that possible ?

1,590 views
Skip to first unread message

Newcomsas

unread,
Jan 29, 2008, 12:37:26 PM1/29/08
to
Hello.
I'm facing a problem that apparently is not well documented on the web. I'm
trying to istantiate an ArrayList in VBScript (on an classic ASP page).
A code like the following works fine (provided the framework is installed
naturally):

Set al = CreateObject( "System.Collections.ArrayList" )
al.Add "F"
al.Add "B"
al.Add "D"
al.Add "C"
call al.insert(2,"john")

My problem is: I would like to create a multi dimensional ArrayList. It is
quite a normal thing in C# but I really can't find out wich is the correct
syntax in VBScript.
I'm persuaded that it should be possible to do that; one is supposed to be
able to use any kind of feature of the .NET class even in VBScript... Is
there anyone who can provide a working code for my needs ?

I thank you in advance for any help.

Newcomsas


mr_unreliable

unread,
Jan 29, 2008, 1:35:17 PM1/29/08
to
hi Newcomsas,

I would say that trying to get the net framework objects to
work with vbscript could be challenging.

Have you thought about using the "dictionary object"? While
it appears to be one-dimensional, you could make it 2-D by
making each item in the dictionary an array.

Or, you could even stretch it to 3-D, 4-D, and so on, by
making the arrays, as arrays-of-arrays.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

McKirahan

unread,
Jan 29, 2008, 1:40:00 PM1/29/08
to
"Newcomsas" <newc...@hotmail.com> wrote in message
news:fnno8e$1mu$1...@aioe.org...

The "Scripting.Dictionary" object is somewhat similar to your object...

I'm not familiar with "ArrayList" so I Google'd it and found this link:

The Beginner's Guide to an ArrayList
http://aspnet101.com/aspnet101/tutorials.aspx?id=24

which starts out with:

"The Beginner's Guide to an ArrayList An ArrayList, at first glance
might be kind of hard to get your head around, if you're a beginner
programmer, or coming from the Classic ASP/HTML world."

Check it out and see if it helps you.


Bob Barrows [MVP]

unread,
Jan 29, 2008, 2:04:41 PM1/29/08
to
Newcomsas wrote:
> Hello.
> I'm facing a problem that apparently is not well documented on the
> web. I'm trying to istantiate an ArrayList in VBScript (on an classic
> ASP page).
> A code like the following works fine (provided the framework is
> installed naturally):
>
> Set al = CreateObject( "System.Collections.ArrayList" )
> al.Add "F"
> al.Add "B"
> al.Add "D"
> al.Add "C"
> call al.insert(2,"john")
>
> My problem is: I would like to create a multi dimensional ArrayList.
> It is quite a normal thing in C#

Are you sure? According to my documentation:

************************************************************************
***
An Array can have multiple dimensions, while an ArrayList or a List
always has exactly one dimension
************************************************************************
***
Are you sure you haven't gotten used to creating arraylists of arrays or
arraylists?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


ekkehard.horner

unread,
Jan 29, 2008, 2:15:29 PM1/29/08
to
Newcomsas schrieb:

> Hello.
> I'm facing a problem that apparently is not well documented on the web. I'm
> trying to istantiate an ArrayList in VBScript (on an classic ASP page).
> A code like the following works fine (provided the framework is installed
> naturally):
>
> Set al = CreateObject( "System.Collections.ArrayList" )
> al.Add "F"
> al.Add "B"
> al.Add "D"
> al.Add "C"
> call al.insert(2,"john")
>
> My problem is: I would like to create a multi dimensional ArrayList. It is
> quite a normal thing in C# but I really can't find out wich is the correct
> syntax in VBScript.

I doubt that:

"An Array can have multiple dimensions, while an ArrayList or a List<(Of <(T>)>)
always has exactly one dimension."
(http://msdn2.microsoft.com/en-us/library/41107z8a.aspx)

> I'm persuaded that it should be possible to do that; one is supposed to be
> able to use any kind of feature of the .NET class even in VBScript...

Computers are tamed by optimists, but a little bit of realism is needed
too. *Some* objects are exposed to late binding Script languages like
VBScript; *some* of their methods are callable (if you know the correct
sequence number); *some* of their parameters and return value (types)
are usable. So you should suppose, that it doesn't work, and only
after (frustating) research and (careful) testing revoke the pessimistic
statement.

> Is there anyone who can provide a working code for my needs ?

Perhaps, if you specify, what you want to achieve with some more details.

[...]

0 new messages