在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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询