dynamically name dynamic arraylists

  • Thread starter Thread starter drdave
  • Start date Start date
D

drdave

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
 
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.
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top