Public Field_Check As New TextHandling
Public Class TextHandling
Function Empty_Checks(ByRef frm As Form) As Boolean
Dim Form_Object As Control
iTerminate = False
For Each Form_Object In frm.Controls
If TypeOf Form_Object Is TextBox Or TypeOf Form_Object Is ComboBox Then
If Form_Object.Text = "" Then
MsgBox(Form_Object.Name & " is empty. Please complete the field.", vbExclamation)
iTerminate = True
Form_Object.Focus()
Exit Function
End If
End If
Next Form_Object
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Field_Check.Empty_Checks(Me)
If iTerminate = True Then
iTerminate = False
Exit Sub
End If
End Sub
No comments:
Post a Comment