By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Dynamically Adding an Object

P: n/a
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...
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Chris Harper" <ch**********@preferredmortgages.com> schrieb

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

Nov 20 '05 #2

P: n/a
* Chris Harper (ch**********@preferredmortgages.com) 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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a
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...
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.