【发布时间】:2012-05-07 16:06:41
【问题描述】:
可能重复:
How do I determine if an array is initialized in VB6?
How do I check for an object being Nothing in VB6?
在函数返回动态数组作为结果的情况下,动态数组可能未初始化(例如,执行错误)。是否可以检查这种情况?
函数 IsNothing() 不起作用,并且 UBound() 在这种情况下会产生错误。
例如:
Function find(results() As String)
[Definition here...]
End Function
[...]
Dim results() As String
find(results)
If UBound(results) > 0 Then '<-- This line will fail when results was not defined
[...]
提前致谢!
【问题讨论】:
-
@finnw 这是重复的,但不是您选择的问题!