Home > Language Reference > Classes > Object
ClassID Property
Returns the type identifier corresponding to the actual class of the object.
Syntax
Public Property Get ClassID() As Long
Remarks
The ClassID property returns the type identifier corresponding to the actual class of the object it is applied to. This value can then be checked against those returned by the TypeID function, allowing run-time type identification.
The following example uses this property to determine whether the control having the focus is a text field or not, and then copy this field content to the clipboard:
Private Sub Button1_Click()
Dim c As Control
Set c = Me.Focus
If c.ClassID = TypeID(Field) Then
Field(c).Copy
End If
End SubThe same fonctionnality can be achieved using the TypeName function; however, this practice is discouraged, as string creation and comparison is much more costly than simply comparing numerical values.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |