如何在 VB6 中检查对象是否为 Nothing? [英] How do I check for an object being Nothing in VB6?
本文介绍了如何在 VB6 中检查对象是否为 Nothing?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 VB6 应用程序中,我有一个这样声明的对象数组...
In my VB6 application I have an array of objects declared thus...
Dim MyArray() as MyClass
这个数组随着处理的进行而被填充
This array is filled in as processing goes on
Set MyArray(element) = passed_object
由于不再需要元素,
Set MyArray(otherelement) = Nothing
使用数组时,我想使用像
When using the array, I want to use a loop like
For i = 1 To Ubound(MyArray)
If MyArray(i) <> Nothing Then ' Doesn't compile
...do something...
End If
Next i
但我无法编译任何可能的东西.我也试过
But I can't get anything likely-looking to compile. I've also tried
If MyArray(i) Is Not Nothing Then
我是否应该这样做,如果是,我应该在这里进行什么测试?
Should I want to do this, and if so, what test should I put in here?
推荐答案
If Not MyArray(i) Is Nothing Then
这篇关于如何在 VB6 中检查对象是否为 Nothing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文