Home All Groups Group Topic Archive Search About

Multi-dimensional array - Question on Data types

Author
8 Oct 2006 3:28 AM
vvenk
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

Author
8 Oct 2006 3:54 AM
ShaneO
vvenk wrote:
> 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.
Author
8 Oct 2006 4:23 AM
Tom Shelton
vvenk wrote:
> 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.

--
Tom Shelton
Author
8 Oct 2006 4:34 AM
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

Show quoteHide quote
"vvenk" <vv***@discussions.microsoft.com> schreef in bericht
news:313885E4-43CB-4FC4-A12E-B17DD2A51D36@microsoft.com...
> 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