16,554
社区成员
发帖
与我相关
我的任务
分享
Public Shared Function IsEmpertyText(ByVal Objs As Windows.Forms.Control.ControlCollection) As Boolean
Dim objCon As Control
For Each objCon In Objs
If TypeOf (objCon) Is TextBox Then
If objCon.Text = "" Then
MsgBox(objCon.Tag.ToString + "不能为空", vbOKOnly + vbExclamation, "警告")
objCon.Focus()
Return False
Exit Function
End If
ElseIf TypeOf (objCon) Is ComboBox Then
If objCon.Text = "" Then
MsgBox(objCon.Tag.ToString + "不能为空", vbOKOnly + vbExclamation, "警告")
objCon.Focus()
Return False
Exit Function
End If
End If
Next
Return True
End Function
Public Shared Function IsEmpertyText(ByVal Objs As Form) As Boolean
For i As Integer = Objs.Controls.Count - 1 To 0 Step -1
If (TypeOf Objs.Controls(i) Is TextBox) Or (TypeOf Objs.Controls(i) Is ComboBox) Then
If Objs.Controls(i).Text.Trim = "" Then
Objs.Controls(i).Focus()
Return False
Exit For
End If
End If
Next
End Function
Public Shared Function IsEmpertyText(ByVal Objs As Form) As Boolean
For i As Integer = Objs.Controls.Count - 1 To 0 Step -1
If (TypeOf Objs.Controls(i) Is TextBox) Or (TypeOf Objs.Controls(i) Is ComboBox) Then
If Objs.Controls(i).Text.Trim = "" Then
MsgBox(Objs.Controls.Find("Lbl" & Objs.Controls(i).Name, True)(0).Text & "不能为空!")
Objs.Controls(i).Focus()
Return False
Exit For
End If
End If
Next
End Function
MsgBox(Objs.Controls(i).Tag + "不能为空!", vbOKOnly + vbInformation, "系统提示")
就完美了~~这个问题应该算是解决了~ Public Shared Function IsEmpertyText(ByVal Objs As Form) As Boolean
For Each objCon As Control In Objs.Controls
If (TypeOf objCon Is TextBox) Or (TypeOf objCon Is ComboBox) Then
If objCon.Text.Trim = "" Then
objCon.Focus()
Return False
Exit For
End If
End If
Next