Two D array ??

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I know how to use arraylist but it seems IT is one-D array.
How can I declare Two-D array ??
Please be kind to give me a little sample. thanks a lot
 
If you want a fixed sized array then you can use an array class. For example
if you want a 10x5 array of integers then the syntax would be:

Dim intArray(9, 4) As Integer

If you want a ragged array then you could have one ArrayList holding
references to other ArrayLists. Off the top of my head the syntax to access
an element in this structure would be:

Dim i As Integer
i = CInt(CType(raggedArray(3), ArrayList)(4))
 
Agnes,

Why are you not using when you want a two D array a datatable.
It is in my opinion so much easier to use.

Cor
 
I need to store the string, but not the integer ...
I try Dim myString(,) as string.
myString(0,0) = "ID"
myString(0,1) = "Name"
However, I got an error "object reference not set to an instance of an
object"

Rob Windsor said:
If you want a fixed sized array then you can use an array class. For
example if you want a 10x5 array of integers then the syntax would be:

Dim intArray(9, 4) As Integer

If you want a ragged array then you could have one ArrayList holding
references to other ArrayLists. Off the top of my head the syntax to
access an element in this structure would be:

Dim i As Integer
i = CInt(CType(raggedArray(3), ArrayList)(4))

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/



Agnes said:
I know how to use arraylist but it seems IT is one-D array.
How can I declare Two-D array ??
Please be kind to give me a little sample. thanks a lot
 

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