Public Class EquipmentNode
'...
End Class
Private Sub DoWork()
Dim node As TreeNode = _contextNode
If node is EquipmentNode ' Does not work
if node is TypeOf EquipmentNode ' Does not work
End Sub
How can I see if the node is the same type. Right now I’m just casting it and seeing if the result is null, but I want to make use of the “Is” operator.
The Visual Basic Is Operator, (unlike the C#’s is operator), does not tell you about the object’s type, but rather whether two objects variables refer to the same actual object instance.
This will not tell you whether the object is a specific type.
To compare types, you’d use: