Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do You Use an External Classes Properties/Methods?

Status
Not open for further replies.

rdeleon

IS-IT--Management
Jun 11, 2002
114
0
0
US
I am new to using vb classes and need some help with syntax (I think).

I have a report and reports class in a dll called RptClassLib that I populate in the Main section of my project.

Dim grpts As RptClassLib.GEMSReports
Dim grpt As RptClassLib.GEMSReport
Dim rs As Recordset

Set grpts = New GEMSReports
Set grpt = New GEMSReport
Set rs = deGEMS.rsReport

rs.Open

Do While Not (rs.EOF)
grpt.GReportDescription = rs.Fields("RptDescription").Value
grpt.GReportName = rs.Fields("RptName").Value
grpts.Add grpt.Key, grpt.GReportName, grpt.GReportDescription, grpt.GReportCategory
rs.MoveNext
Loop

rs.Close

This appears to work fine. My problem is: I thought once I instantiated the classes I could use them throughout my project without having to re-instantiate them.

I have added a form to my project and want to use the class properties to populate some list boxes. I assume that I would populate the form controls in the form_load event. What is the syntax for doing this?

Any help or information source is appreciated.

Rene'
 
Classess, like any other object, have scope according where and how they are declared. You could create instances of these classes in whatever startup you use and keep them for the entire session but I would create them only as they are required. That way, they will be created/dropped within their scope and 'baggage' is kept to a minimum.
 
Thanks, I didn't realise that the Dim is declaring the objects as private rather than public.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top