468,104 Members | 1,305 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,104 developers. It's quick & easy.

dynamically name dynamic arraylists

I would like to have ten arraylists created within a loop.. is there a
conversion or something I can do to acheive this..

pseudo:

Dim counter As Integer = 0
Dim ArrName As ArrayList

'******** LOOP OVER THE VALUES ********************

For Each y in ProvArrList

ArrName = ("Arrname") & counter.ToString
Dim ArrName As New Arraylist ()
counter = (counter + 1)
Next

course this gives me error' Value of type string cannot be converted to
system.collection.arraylist

Is there another way to accomplish this??
tia

Dave

Dec 8 '05 #1
5 2167
Why not add them to a Hashtable?

<dr****@canoemail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I would like to have ten arraylists created within a loop.. is there a
conversion or something I can do to acheive this..

pseudo:

Dim counter As Integer = 0
Dim ArrName As ArrayList

'******** LOOP OVER THE VALUES ********************

For Each y in ProvArrList

ArrName = ("Arrname") & counter.ToString
Dim ArrName As New Arraylist ()
counter = (counter + 1)
Next

course this gives me error' Value of type string cannot be converted to
system.collection.arraylist

Is there another way to accomplish this??
tia

Dave

Dec 8 '05 #2
I need to use Arraylists as I need the data in a specific order.. I
tried using hashtables but the data got all jumbled around.. I tried
using sortedlists as well but it sorted my data... not the way I
needed it.. :o(

or can I store my arraylists inside a hashtable.. hmm I had not thought
of that I'll check it out.. I would have to fill the arraylists before
adding them to the hashtable..

I eventually want to bind 10 different repeaters to the arraylists

thx.

Dec 8 '05 #3
I mean put the ArrayLists in the Hashtable. For instance.

pseudocode:

Create hash table myHT;
for x = 0 to 10
{
Create new array list newList;
Create key to identify array list (key = "array" + x);
Add new list to hashtable (myHT.add(key, newList);
}

// Now you have all the arrays and each hashtable element is your varaible.

<dr****@canoemail.com> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
I need to use Arraylists as I need the data in a specific order.. I
tried using hashtables but the data got all jumbled around.. I tried
using sortedlists as well but it sorted my data... not the way I
needed it.. :o(

or can I store my arraylists inside a hashtable.. hmm I had not thought
of that I'll check it out.. I would have to fill the arraylists before
adding them to the hashtable..

I eventually want to bind 10 different repeaters to the arraylists

thx.

Dec 8 '05 #4
I'll try that out..

Thx!!

Dec 8 '05 #5
If the key is going to be meaningless, why not simply add them to an
arraylist?

ArrayList list = new ArrayList(10);
for (int x = 0; i < 10; ++x)
{
list.Add(new ArrayList());
}

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:et*************@TK2MSFTNGP14.phx.gbl...
I mean put the ArrayLists in the Hashtable. For instance.

pseudocode:

Create hash table myHT;
for x = 0 to 10
{
Create new array list newList;
Create key to identify array list (key = "array" + x);
Add new list to hashtable (myHT.add(key, newList);
}

// Now you have all the arrays and each hashtable element is your
varaible.

<dr****@canoemail.com> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
I need to use Arraylists as I need the data in a specific order.. I
tried using hashtables but the data got all jumbled around.. I tried
using sortedlists as well but it sorted my data... not the way I
needed it.. :o(

or can I store my arraylists inside a hashtable.. hmm I had not thought
of that I'll check it out.. I would have to fill the arraylists before
adding them to the hashtable..

I eventually want to bind 10 different repeaters to the arraylists

thx.


Dec 8 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by AMP | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.