How to check type of object in VB 6 - Is there any method other than 'TypeName'

后端 未结 3 907
半阙折子戏
半阙折子戏 2020-12-04 02:53

How to check type of object in VB 6 - Is there any method other than \'TypeName\' because its not feasible to check it witrh \'TypeName\' I am expecting something like Quich

3条回答
  •  暖寄归人
    2020-12-04 03:35

    For object variables, use TypeOf ... Is:

    If TypeOf VarName Is TypeName Then
      ''# ...
    End If
    

    For example:

    Dim fso As New Scripting.FileSystemObject
    
    If TypeOf fso Is Scripting.FileSystemObject Then
      Debug.Print "Yay!"
    End If
    

提交回复
热议问题