Structure

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
 
K

Karl Seguin [MVP]

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top