Dynamically Adding an Object

  • Thread starter Thread starter chris.harper
  • Start date Start date
C

chris.harper

Hi,

Currently I have this code:

Dim arrData(intNoOfRows, intNoOfColumns) As Object

I want to dynamically add x amount of objects. Something like this:

For intX = 1 to intCounter

arrData(intX)(intNoOfRows, intNoOfColumns)

Next

Obviously the above code doesn't work. BUT, I'm sure someone out there knows how to do it.

Please could you tell me.

Thanks,

Chris

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Chris Harper said:
Currently I have this code:

Dim arrData(intNoOfRows, intNoOfColumns) As Object

I want to dynamically add x amount of objects. Something like
this:

For intX = 1 to intCounter

arrData(intX)(intNoOfRows, intNoOfColumns)

Next

Obviously the above code doesn't work. BUT, I'm sure someone out
there knows how to do it.

In which column and row do you want to put which object? Could you please
describe it?


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
* Chris Harper ([email protected]) scripsit:
Currently I have this code:

Dim arrData(intNoOfRows, intNoOfColumns) As Object

I want to dynamically add x amount of objects. Something like this:

For intX = 1 to intCounter

arrData(intX)(intNoOfRows, intNoOfColumns)

Next

Have a look at 'ReDim Preserve', maybe it helps in this situation. I am
not sure because I do not understand your pseudo code.
 
Well, in the pseudo code:

For intX = 1 to intCounter

arrData(intX)(intNoOfRows, intNoOfColumns)

Next

The output I'd want is:

arrData1
arrData2
arrData3...etc.

I.e. A new object of arrData is created with each loop.

Does this make it more clear?

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Back
Top