Dim MyObject as MyClassThe IS operator must be used within an If - Then statement.
Dim MyOtherObject as MyClass
Set MyObject = New MyClass
Set MyOtherObject = MyObject
'Now, the two object variables reference the same object.
If MyOtherObject Is MyObject Then
'The message box should pop up:
MsgBox "Yes, MyObject points to the same object as MyOtherObject and vice versa"
End If
Tuesday, December 16, 2008
[vb6] Use the IS operator to compare objects
With ordinary variables you would use the = operator to compare different variables. This does not work with object variables. Instead you have to use the IS operator, e.g.:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment