Re: Multidimensional ArrayList how to?
From: SpotNet (SpotNet_at_msnews.grp)
Date: 10/16/04
- Next message: Viktor Popov: "Re: Stored procedure->ASP.NET application"
- Previous message: Mahesh Devjibhai Dhola: "Re: Multidimensional ArrayList how to?"
- In reply to: Daniel O'Connell [C# MVP]: "Re: Multidimensional ArrayList how to?"
- Next in thread: Mahesh Devjibhai Dhola: "Re: Multidimensional ArrayList how to?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 16 Oct 2004 16:36:32 +1000
Thanks Daniel, I'm trying to populate the array
GetDataMatrix[0,0].Add(15); throws the exception, I've got the impression
that GetDataMatrix[0,0].Add(15) method, adds the int 15 (as an object) to
the array. Inferring form your response from the declaration,
System.Collections.ArrayList[,] GetDataMatrix = New
System.Collections.ArrayList[10, 3];
I have to instantiate;
GetDataMatrix[0,0], GetDataMatrix[1,0], ...,GetDataMatrix[9,2] (in a loop of
course) and then assign them values?
Thanks again Daniel you've got me closer, I'll try it out...
Regards,
SpotNet
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%23Ezg8c0sEHA.3788@TK2MSFTNGP15.phx.gbl...
:
: "SpotNet" <SpotNet@msnews.grp> wrote in message
: news:%23j1yFQ0sEHA.3460@TK2MSFTNGP15.phx.gbl...
: > Hi NewsGroup;
: >
: > Trying to construct a Multidimensional (2D more specifically) populated
: > from
: > an OleDbDataReader. Reason I'm using an ArrayList is I do not know the
: > size
: > of the first dimension (being rows), here's my final attempt below;
: >
: > System.Collections.ArrayList[,] GetDataMatrix = New
: > System.Collections.ArrayList[10, 3]; //Let's just say 10, 3
: >
: > Keeping it brief and simple excuse the syntax,
: >
: > GetDataMatrix[0,0].Add(15);
: >
: > Throws an exception right at me stating that, 'Object reference is not
an
: > instance of the object'. If only 'System.Collections.ArrayList' could
: > talk
: > 'cause I have a few hard words for it, well the multi-dimensional case
: > anyway. What am I doing wrong?
: >
:
: Out of curiosity, are you populating the ArrayList[] members? All you are
: showing here is the creation of the array. ALl of its members will be null
: until you explicitly instantiate them.
: >
:
:
- Next message: Viktor Popov: "Re: Stored procedure->ASP.NET application"
- Previous message: Mahesh Devjibhai Dhola: "Re: Multidimensional ArrayList how to?"
- In reply to: Daniel O'Connell [C# MVP]: "Re: Multidimensional ArrayList how to?"
- Next in thread: Mahesh Devjibhai Dhola: "Re: Multidimensional ArrayList how to?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|