Home
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
 
 
 
 
TitleMake a collection class
Keywordscollection class
CategoriesSoftware Engineering
 
By Vijay Sharma.

Make a class named clsEmployees to hold information about an employee. Then make an Employees class that holds clsEmployees objects. Give that class methods for adding, listing, and removing clsEmployee objects. For example, the following code creates a new clsEmployee object, adds it to the Employees object's collEmployees collection, and returns a reference to the new object. See the code for other routines.

 
Public Function Add(ByVal EmpNo As Long, ByVal EmpName As _
    String, ByVal EmpSalary As Double) As clsEmployee
Dim objEmployee As New clsEmployee

    objEmployee.EmployeeNo = EmpNo
    objEmployee.EmployeeName = EmpName
    objEmployee.EmployeeSalary = EmpSalary
  
    collEmployees.Add objEmployee, CStr(EmpNo)
  
    Set Add = objEmployee
End Function
 
 
Copyright © 1997-2001 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated