Re: Use a variable to call an arraylist

Tech-Archive recommends: Fix windows errors by optimizing your registry



It's obvious that I haven't had enough caffiene yet!!

I don't know how DirectCast(alName,ArrayList).DoArrayListStuff slipped my
mind!

cheers
Lee

"lgbjr" <lgbjr@xxxxxxxxxx> wrote in message
news:e3D4vXBzFHA.2540@xxxxxxxxxxxxxxxxxxxxxxx
> Hi All,
>
> I have 10 arraylists in a VB.NET app. Based on the state of various
> checkboxes and radiobuttons, a set of data is read into these arraylists.
> I don't know how many of the arraylists will be used until runtime. what
> I'd like to do is something like this:
>
> Dim AL1 as New ArrayList
> ..
> Dim AL10 as New ArrayList
> Dim alName as string
> Dim i, j as Integer
> i = some number between 1-10 '(determined by user selections)
> For j = 1 to i
> alName="AL"+j.ToString
> ' ***Something that uses the value of alName to call the appropriate
> ArrayList***
> ' ***Code to add the right stuff to the right ArrayList***
> Next j
>
> does that make sense? I know I can use a bunch of If..Then..ElseIfs, but I
> thought the above method would be a bit more elegant.
>
> TIA
> Lee
>


.


Quantcast