Private Sub txtUserName_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtUserName.Validating ErrorProvider1.SetError(txtUserName, "") With txtUserName If .Text = String.Empty Then BtnCancel_LoginForm.CausesValidation = False BtnBack_LoginForm.CausesValidation = False 'cancel the event e.Cancel = True ErrorProvider1.SetError(txtUserName, "Required field") Label2.ForeColor = Color.Red Else Label2.ForeColor = Color.Maroon End If End With End Sub
'CausesValidation'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)