Property in User define Class ? 
Author Message
 Property in User define Class ?

Can i use program browse the User Define Class Property , event and Method ?

example : a function <IsProperty>

Return = Object.IsProperty("Add")

Return = True if Object have Add Property

So , How can i write a function IsProperty ?

Michael Ma



Tue, 27 Mar 2001 03:00:00 GMT  
 Property in User define Class ?
Michael,

Add reference to your project to 'TypeLib Information'. This is wonderful,
but rarely used library written by well-known Matthew Curland. File is
redistributable.

Note that it provides "Global SingleUse' object, so don't need to explicitly
create it.

Use the following code:

Public Function HasProperty(ByVal obj As Object, ByVal sPropName As String)
As Boolean
'Get reference to default interface of object
Dim ii As InterfaceInfo
Set ii = TLI.TLIApplication.InterfaceInfoFromObject(obj)

Dim dummy As MemberInfo

On Error GoTo ErrQuit
'Try access specified property
Set dummy = ii.Members(sPropName)

Select Case dummy.InvokeKind
  Case INVOKE_PROPERTYGET, INVOKE_PROPERTYPUT, INVOKE_PROPERTYPUTREF
    HasProperty = True
    'Object has this property
End Select

Exit Function
ErrQuit:

End Function

HTH,

Alexander Shirshov

Quote:

>Can i use program browse the User Define Class Property , event and Method
?

>example : a function <IsProperty>

>Return = Object.IsProperty("Add")

>Return = True if Object have Add Property

>So , How can i write a function IsProperty ?

>Michael Ma




Tue, 27 Mar 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Property in User define Class ?

2. Property in User define Class ?

3. Property in User define Class ?

4. Array as Property or Field in User Defined Class

5. User-defined data types as class property?

6. Passing Classes to other classes (using user defined types)

7. Set Nothing to user-defined Image property through Properties Window

8. User-defined error when the user doesn't define any errors

9. User Control - User-defined type not defined

10. instantiating a user-defined class ( object ) from a string

11. User-Defined Class Objects

12. Classes, Collections, and User Defined Types

 

 
Powered by phpBB® Forum Software