Dynamically Creating Objects

  • Thread starter Thread starter chris
  • Start date Start date
C

chris

I know I've asked this before, but I didn't really get an answer and I
bet it's because I didn't explain myself very well. Here goes again.

I have this code:

Dim arrData(intNoOfRows, intNoOfColumns) As Object

Dim intR As Integer

For intC As Integer = 0 To intNoOfColumns - 1
arrData(intR, intC) = ds.Tables(0).Columns.Item
(intC).ColumnName

For intR = 0 To intNoOfRows - 1
arrData(intR, intC) =
ds.Tables(0).Rows(intR).Item(intC)
Next
Next


What I want to do instead is:

Dynamically create the required amount of arrData objects, by
incrementing them by one. i.e. pseudo code:

Dim arrData(inX)(intNoOfRows, intNoOfColumns) As Object

Where intX will be the incrementation that will give me the following
type output:

arrData1
arrData2...etc.

Any Ideas?

Thanks
 
Hi Chris,

In my opinion do you not want to dynamicly creating objects, however
creating mnemonics at run time.

However what is the difference between your wish and this.

Dim arrData(inXNoOf tables, intNoOfRows, intNoOfColumns) As Object

arrData(1)
arrData(2)...etc.

In my opinion are you now creating dynamicly objects in runtime.
When I would show it with an arraylist in a sample you would see that the
reference to the object is added.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top