判断动态数组是否为空

前端之家收集整理的这篇文章主要介绍了判断动态数组是否为空前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面是一个判断动态数组是否为空,及是否被赋值过的样例程序。

Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (ByRef Ptr() As Any) As Long

Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any,ByRef Source As Any,ByVal Length As Long)

Function Not_Null(MyArr() As Variant) As Long
Dim pMyarr As Long
CopyMemory pMyarr,ByVal VarPtrArray(MyArr),4
Not_Null = pMyarr

End Function

Sub test() Dim arr() As Variant If Not_Null(arr) <> 0 Then MsgBox "该数组不为空" Else MsgBox "该数组为空数组" End If End Sub 原文链接:https://www.f2er.com/vb/259342.html

猜你在找的VB相关文章