在VB.NET中怎么样判断一个数组是不是为空
的有关信息介绍如下:一: 利用错误捕获功能判断
Dim ArrayS() As String
Private Sub Command1_Click()
On Error GoTo z
ReDim ArrayS(10)
If UBound(ArrayS) > -1 Then
MsgBox "数组不为空"
End If
Exit Sub
z:
MsgBox "数组空"
End Sub
二、 Join方法:
Dim ArrayS() As String
Private Sub Command1_Click()
If (CStr(Join(ArrayS, ""))) = "" Then
MsgBox "为空"
Else
MsgBox "不为空"
End If
End Sub
假设数组名是arr,
MsgBox(arr Is Nothing)返回true则为空,返回false则不为空
首先你得定义什么叫“数组为空”