Multi-dimensional array - Question on Data types

G

Guest

Hello:

Is is possible to declare a 2-dimensional array, the first dimension being
an Integer and the 2nd dimension another data type, say string?

Or, is this a bad choice and a dataset may be a better way of handling
multi-dimensional data where the data types may not be the same?

venki
 
S

ShaneO

vvenk said:
Hello:

Is is possible to declare a 2-dimensional array, the first dimension being
an Integer and the 2nd dimension another data type, say string?

venki
Not that I know of, but look up Structure under Help. That's what I
would suggest as your best option.

eg.
Private Structure myStructure
Dim iInteger as Integer
Dim sString as String
End Structure
Dim myArray() as myStructure


Hope this helps,

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
 
T

Tom Shelton

vvenk said:
Hello:

Is is possible to declare a 2-dimensional array, the first dimension being
an Integer and the 2nd dimension another data type, say string?

Or, is this a bad choice and a dataset may be a better way of handling
multi-dimensional data where the data types may not be the same?

venki

venki,

Can you give us some more detail on what you want to accomplish? I
have a feeling that there maybe a be a better way to accomplish what
your after, but a brief description might help us better help you.
 
C

Cor Ligthert [MVP]

vvenk,

If it is only an array, than a generic list of your own class is in my idea
the most simple.

Class TheClass
public a as string
public b as string
End Class

Dim a As New List(Of theclass)
a.Add(New theclass)
a(0).a = 0
a(0).b = "mystring"

Although see that the class is terrible made, properties and a constructor
would make it nicer (better)

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

Similar Threads

Array Function 9
Multi-Dimensional Array 17
Sorting multi-dimensional array 2
Multi Dimensional Arrays 4
vba array logic 3
2 dimensional array question 6
Multi-dimensional array 5
DataTable or Array 5

Top