Structure

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have created a structure, MyStruct, with 3 properties: Name
(String), Valid (Boolean) and Type (Enumeration Type).

I need to do the following:
1. Create a list of items of type MyStruct using a simple method like:
MyStruct.Add(...)
2. Access each list item using a For Loop.

Could someone, please help me out?

I have been trying collections, arrays, adding methods inside my
structure but I have not been able to make this work.

Thank You Very Much,
Miguel
 
If you are using 2.0, a generic list is the best approach.

dim something as new List(of MyStruct)

something.Add(firstStructure)

for each struct as MyStruct in something
'do something
next

Karl

In 1.x, you can either use an ArrayList, or create a custom collection by
extending the CollectionBase class
 
Back
Top