Collections

mattcya

Member
Joined
Jun 18, 2004
Messages
16
Programming Experience
Beginner
Hi I am trying to addd five employee objects to a myEmployee collection that are listed in the Employee object table but i am having trouble on how i would do this. I am having trouble telling vb.net to reference to the employee object

Hope i can get help

Thanks guys & Gals

Here is my code...

myEmployee.Add(New Employee("Rose Kearns", 50000.0))

myEmployee.Add(
New Employee("Even Bishop", 45000.0))

 

mathpath

Active member
Joined
Aug 21, 2004
Messages
27
Programming Experience
10+
If you had defined your class member as an ArrayList

Public myEmployee As ArrayList = New ArrayList()

You should have no problem adding on members the way you did it by adding new items to the list using myEmployee.Add(...)

And to reference to the individual items, you just have to mention:

myEmployee.Item(i).salary
or
myEmployee.Item(i).name,

where i goes from 0 to the number of employees-1.

Happy programming.
 
Top Bottom