Brett,
As Ken suggests define a Structure or Class to hold a single item.
' From Ken's post
Public Class MyData
...
End Class
Then define an array to hold a collection of these items.
Dim list(5 - 1) As MyData ' list of 5 MyData objects
' explicitly create each element of array
For i = 0 To list.count - 1 'where count is 5
list(i) = New MyData(...)
Next
' do something to each property of each element
For i = 0 To list.count - 1 'where count is 5
list(i).p1 = something
list(i).p2 = something
list(i).p3 = something
Next
Because we defined MyData as Class, you need to create an instance of the
class in each array element first. If we had defined MyData as a Structure,
each element would be automatically created. Its the primary difference
between Reference types (classes) and Value types (structures).
As the others have suggested, using an ArrayList or Hashtable (or other
collections from System.Collections & System.Collections.Specialized) may be
a better fit for the problem at hand. Normally I create a specialized
collection that inherits from DictionaryBase or CollectionBase so my
collection is strongly typed...
Hope this helps
Jay
"Brett" <no@spam.net> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
I need an object/structure such as an array but each item within the array
is a complex structure. For example, I have 5 items, say:
A thru E. The number of items may change. Each item has certain
properties. Such as:
A.p1
A.p2
A.p3
......
E.p1
E.p2
E.p3
I'll assign values, via a loop, to what ever structure will hold these
complex types. For example:
For i = 0 To structure.count 'where count is 5
structure(i).p1 = something
structure(i).p2 = something
structure(i).p3 = something
Next
What type of structure will I need for the above?
Thanks,
Brett