如何在 VB 6 中检查对象的类型 - 除了“TypeName"之外还有其他方法吗 [英] How to check type of object in VB 6 - Is there any method other than 'TypeName'

查看:33
本文介绍了如何在 VB 6 中检查对象的类型 - 除了“TypeName"之外还有其他方法吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 VB 6 中检查对象类型 - 是否有除TypeName"之外的任何方法,因为用TypeName"检查它是不可行的,我期待类似 QuichWatch 窗口的东西.

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 QuichWatch window.

推荐答案

对于对象变量,使用 TypeOf ... Is:

For object variables, use TypeOf ... Is:

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

例如:

Dim fso As New Scripting.FileSystemObject

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

这篇关于如何在 VB 6 中检查对象的类型 - 除了“TypeName"之外还有其他方法吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆