473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

multidimensional arrays and array lists

Rob
Hi,

I want to create an arraylist of multidimension arrays. Currently I've
managed to do these via conventional means as follows:

Dim myarraylist As ArrayList = New ArrayList()

Dim array1(,) As String = {{"bill"}, {"jill"}}

Dim array2(,) As String = {{"bob"}, {"jan"}}

myarraylist.Add(array1)

myarraylist.Add(array2)

However, I'd like to avoid having to declare each array, and assign the data
straight to the arraylist. Something like the following:

Dim myarraylist As ArrayList = New ArrayList()

myarraylist.Add({{"bill"}}, "jill"}})

myarraylist.Add({{"bob"}, {"jan"}})

Obviously, this example does not work, but does anyone know if I can
actually do it this way, or do I have to declare and initialise the arrays
first?

Thanks

Jul 26 '07 #1
2 1867
"Rob" <r_******@ozemail.com.auschrieb
Hi,

I want to create an arraylist of multidimension arrays. Currently
I've managed to do these via conventional means as follows:

Dim myarraylist As ArrayList = New ArrayList()

Dim array1(,) As String = {{"bill"}, {"jill"}}

Dim array2(,) As String = {{"bob"}, {"jan"}}

myarraylist.Add(array1)

myarraylist.Add(array2)

However, I'd like to avoid having to declare each array, and assign
the data straight to the arraylist. Something like the following:

Dim myarraylist As ArrayList = New ArrayList()

myarraylist.Add({{"bill"}}, "jill"}})

myarraylist.Add({{"bob"}, {"jan"}})

Obviously, this example does not work, but does anyone know if I can
actually do it this way, or do I have to declare and initialise the
arrays first?
myarraylist.Add(New String(,) {{"bill"}, {"jill"}})
Armin
Jul 26 '07 #2
Rob
Thanks for that. I thought I had tried that, but I must have got something
wrong at the time.

"Armin Zingler" <az*******@freenet.dewrote in message
news:OW**************@TK2MSFTNGP03.phx.gbl...
"Rob" <r_******@ozemail.com.auschrieb
>Hi,

I want to create an arraylist of multidimension arrays. Currently
I've managed to do these via conventional means as follows:

Dim myarraylist As ArrayList = New ArrayList()

Dim array1(,) As String = {{"bill"}, {"jill"}}

Dim array2(,) As String = {{"bob"}, {"jan"}}

myarraylist.Add(array1)

myarraylist.Add(array2)

However, I'd like to avoid having to declare each array, and assign
the data straight to the arraylist. Something like the following:

Dim myarraylist As ArrayList = New ArrayList()

myarraylist.Add({{"bill"}}, "jill"}})

myarraylist.Add({{"bob"}, {"jan"}})

Obviously, this example does not work, but does anyone know if I can
actually do it this way, or do I have to declare and initialise the
arrays first?

myarraylist.Add(New String(,) {{"bill"}, {"jill"}})
Armin
Jul 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Golf Nut | last post by:
I am finding that altering and affecting values in elements in multidimensional arrays is a huge pain in the ass. I cannot seem to find a consistent way to assign values to arrays. Foreach would...
0
by: Wihlelm Bierbaum | last post by:
I'm trying to make use of a certain method of a COM object that takes a multidimensional array as its sole parameter. Here's an example of the construction of said array: $cA = array(); $cA =...
5
by: TLOlczyk | last post by:
I have a brain cramp and I need some help. I have a chunk of code below which demonstrates a problem I have with multidimensional arrays. I want to keep it simple but something specific is...
2
by: Terry | last post by:
Hi, can someone plz tell me how multidimensional arrays (like a 2-D array) are stored in memory? Are they like single dimensional arrays? Stored sequentially in one "row", so to say? Thanks ...
9
by: Charles Banas | last post by:
i've got an interesting peice of code i'm maintaining, and i'd like to get some opinions and comments on it, hopefully so i can gain some sort of insight as to why this works. at the top of the...
3
by: Claire | last post by:
I have a multidimensional array defined as private double myArray = new double; The first column of the array contains X values, the other contains Y values I have a charting function defined as...
2
by: d[ - - ]b | last post by:
Hi there, Just wondering, if there is any way to have a dynamic / unspecified size of an array? It obviously needs to be updated, deleted etc. The only way I thought is by making the array...
10
by: | last post by:
I'm fairly new to ASP and must admit its proving a lot more unnecessarily complicated than the other languages I know. I feel this is because there aren't many good official resources out there to...
12
by: filippo nanni | last post by:
Hello everybody, my question is this: I have two multidimensional arrays and I have to create a third one (for later use) from comparing these two. Here is my example code: //BEGIN CODE var...
9
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.