62,046
社区成员
发帖
与我相关
我的任务
分享
Protected Function checknull(ByVal list As String(), ByVal sw As Boolean) As Boolean
If list.Length <> 0 Then
Dim obj As New Object
Dim i As Integer
Dim flag As Boolean = False
If sw = True Then
For i = 0 To list.Length - 1
obj = FindControl(list(i))
If TypeOf obj Is TextBox Then
If CType(obj, TextBox).Text = "" Then
Return False
End If
ElseIf TypeOf obj Is DropDownList Then
If CType(obj, DropDownList).SelectedValue = CStr(0) Then
Return False
End If
End If
Next
Return True
Else
For Each obj In Controls(1).Controls
For i = 0 To list.Length - 1
---问题出在这里--------- If obj = list(i) Then ----------------------------
flag = True
End If
Next
If flag = False Then
If TypeOf obj Is TextBox Then
If CType(obj, TextBox).Text = "" Then
Return False
End If
ElseIf TypeOf obj Is DropDownList Then
If CType(obj, DropDownList).SelectedValue = CStr(0) Then
Return False
End If
End If
End If
Next
Return True
End If
End If
End Function