Creating a multi dimensional array

G

Guest

I need to create a public multi-dim array that can hold a mixture of string
and int values. I will need to search this array for a value and return a
value from a subscript.

This array will expand as it reads in records, so I will need to preserve
the current contents.

For example, I currently do this in Visual Foxpro.

Public laList(1,5)
j=1
select mydataset
scan
dimension myList(j,5) && Resize the array
lcName=mydataset.customername
laList[j,1]=j
laList[j,2]=0123456789
laList[j,3]=lcName
laList[j,4]='Name'
laList[j,5]='1,2'
j=j+1
endscan

When I click on a control on the form, I search the laList array for the
controls value laList[j,5], and read the corresponding laList[j,2] value
which in turns gets another set of data and populates a different control.

How can I accomplish this in VB.Net ???

Thanks.
 
C

Chris

Dino said:
I need to create a public multi-dim array that can hold a mixture of string
and int values. I will need to search this array for a value and return a
value from a subscript.

This array will expand as it reads in records, so I will need to preserve
the current contents.

For example, I currently do this in Visual Foxpro.

Public laList(1,5)
j=1
select mydataset
scan
dimension myList(j,5) && Resize the array
lcName=mydataset.customername
laList[j,1]=j
laList[j,2]=0123456789
laList[j,3]=lcName
laList[j,4]='Name'
laList[j,5]='1,2'
j=j+1
endscan

When I click on a control on the form, I search the laList array for the
controls value laList[j,5], and read the corresponding laList[j,2] value
which in turns gets another set of data and populates a different control.

How can I accomplish this in VB.Net ???

Thanks.

Have you thought of doing an array of arraylists?

Arraylists allow you to have multi datatypes associated with it and
allows for expand/contracting.

Dim laList as new arraylist
dim ExpandList as new arraylist
laList.add(ExpandList)

Chris
 
H

Herfried K. Wagner [MVP]

Dino said:
I need to create a public multi-dim array that can hold a mixture of string
and int values. I will need to search this array for a value and return a
value from a subscript.

Check out the documentation for VB.NET's 'Dim' and 'ReDim' statements.
 

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

Top