菜鸟问题 关于Msgbox的应用
我用DATA控件把几个字段绑定到TEXTBOX中,例如:姓名、出生年月、员工号,现在我要是在这些TEXTBOX 中置空值的话就弹出“XX为空,你必须输入XX”字样,下面有个程序样板,但缺个Utility类,谁能帮我把这个类写出来啊,谢谢大虾们了
Private Sub datEmployees_Validate(Action As Integer, Save As Integer)
Dim strMsg As String
Dim enumMsgResult As VbMsgBoxResult
If Save = True Or Action = vbDataActionUpdate _
Or Action = vbDataActionUnload Then
strMsg = ""
If txtEmpLastName.Text = "" Then
Utility.addtomsg strMsg, "You must enter a last name."
txtEmpLastName.SetFocus
End If
If txtEmpFirstName.Text = "" Then
Utility.addtomsg strMsg, "You must enter first name."
txtEmpFirstName.SetFocus
End If
If Not IsDate(txtBirthDate.Text) Then
Utility.addtomsg strMsg, "You must enter a birth date."
txtBirthDate.SetFocus
Else
If CDate(txtBirthDate.Text) >= Date Then
Utility.addtomsg strMsg, "Birth date must be in the past."
txtBirthDate.SetFocus
End If
End If
If strMsg <> "" Then
MsgBox strMsg, vbExclamation
Action = vbDataActionCancel
mblnvalidationfailed = True
Else
mblnablidationfailed = False
End If
End If
End Sub