Passing a form as an argument

C

CDM

Is it possible to pass a class module as an argument and set up a 'For Each'
that loops through each of the properties? I'm not sure how to reference the
property.
For example:

Private Sub LoadClass(mdl as module)
Dim prp as property 'Not sure this is possible
for each prp in mdl.properties
prp = [something]
next

This assumes I have dimmed a new class module in the calling procedure.
thanks for any help you can offer.
 
M

Michel Walsh

A class, in order to read its exposed properties? Need to have an object.
With Access and an class Form1, something like:

===================================
Option Compare Database
Option Explicit

Function GetClassInfo() As String

Dim TLIapp As New TLI.TLIApplication
Dim ParamInfo As TLI.ParameterInfo
Dim Members As TLI.Members
Dim MemberInfo As TLI.MemberInfo

Dim s As String
Dim temp As String

Dim xxxx As Form_Form1

Set xxxx = New Form_Form1

' --- chose one of the following example
Set Members = TLIapp.InterfaceInfoFromObject(xxxx).Members
Set Members = TLIapp.InterfaceInfoFromObject(Application.DoCmd).Members

' enumerate
For Each MemberInfo In Members
With MemberInfo
s = vbNullString
For Each ParamInfo In .Parameters
s = s & ParamInfo.Name & ", "
Next
If Right(s, 2) = ", " Then s = Left(s, Len(s) - 2)
s = "(" & s & ")"
temp = temp & .MemberId & " " & .Name & s & vbCrLf
End With
Next MemberInfo

GetClassInfo = temp
End Function
==================================


.... and maybe the most important, you need a reference to tlbinf32.dll, from
your WINDOWS\SYSTEM32 folder.



Vanderghast, Access MVP
 
C

CDM

Wow! Thanks.

Michel Walsh said:
A class, in order to read its exposed properties? Need to have an object.
With Access and an class Form1, something like:

===================================
Option Compare Database
Option Explicit

Function GetClassInfo() As String

Dim TLIapp As New TLI.TLIApplication
Dim ParamInfo As TLI.ParameterInfo
Dim Members As TLI.Members
Dim MemberInfo As TLI.MemberInfo

Dim s As String
Dim temp As String

Dim xxxx As Form_Form1

Set xxxx = New Form_Form1

' --- chose one of the following example
Set Members = TLIapp.InterfaceInfoFromObject(xxxx).Members
Set Members = TLIapp.InterfaceInfoFromObject(Application.DoCmd).Members

' enumerate
For Each MemberInfo In Members
With MemberInfo
s = vbNullString
For Each ParamInfo In .Parameters
s = s & ParamInfo.Name & ", "
Next
If Right(s, 2) = ", " Then s = Left(s, Len(s) - 2)
s = "(" & s & ")"
temp = temp & .MemberId & " " & .Name & s & vbCrLf
End With
Next MemberInfo

GetClassInfo = temp
End Function
==================================


.... and maybe the most important, you need a reference to tlbinf32.dll, from
your WINDOWS\SYSTEM32 folder.



Vanderghast, Access MVP



CDM said:
Is it possible to pass a class module as an argument and set up a 'For
Each'
that loops through each of the properties? I'm not sure how to reference
the
property.
For example:

Private Sub LoadClass(mdl as module)
Dim prp as property 'Not sure this is possible
for each prp in mdl.properties
prp = [something]
next

This assumes I have dimmed a new class module in the calling procedure.
thanks for any help you can offer.
 

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

Top