Thursday, March 22, 2012

Structure

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,
MiguelIf 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

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"shapper" <mdmoura@.gmail.comwrote in message
news:1173113846.509770.105130@.q40g2000cwq.googlegr oups.com...

Quote:

Originally Posted by

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
>

0 comments:

Post a Comment