private void TxtMobileNo_Validating(object sender, CancelEventArgs e) { if (_Tag == "" || this.ActiveControl == TxtMobileNo) { return; } if (string.IsNullOrEmpty(TxtMobileNo.Text)) { MessageBox.Show("Mobile No Cannot Left Blank...!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtMobileNo.Focus(); return; } else if (_Tag == "NEW") { if (_objUserMaster.CheckDuplicateMobileNo(TxtMobileNo.Text) == 1) { MessageBox.Show("Mobile No Already Exist...!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtMobileNo.Focus(); return; } if (TxtMobileNo.TextLength != 10) { MessageBox.Show("Mobile No Must be ten character...!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtMobileNo.Focus(); return; } } }
private void TxtMobileNo_Validating(object sender, CancelEventArgs e) { if (string.IsNullOrEmpty(TxtMobileNo.Text)) { MessageBox.Show("User MobileNo Cannot Left Blank...!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); e.Cancel = true; TxtMobileNo.Focus(); return; } }
private string ValidateControlles() { string ValidateMessage = string.Empty; if (string.IsNullOrEmpty(TxtUserName.Text.ToString())) { TxtUserName.Focus(); return("Please enter the user name"); } if (string.IsNullOrEmpty(TxtPassword.Text.ToString())) { TxtPassword.Focus(); return("Please enter the password"); } if (DropDownUserRole.SelectedIndex <= 0) { DropDownUserRole.Focus(); return("Please select the role type"); } if (string.IsNullOrEmpty(TxtMobileNo.Text.ToString())) { TxtMobileNo.Focus(); return("Please enter the mobile number"); } if (string.IsNullOrEmpty(TxtSEmailId.Text.ToString())) { TxtSEmailId.Focus(); return("Please enter email id"); } if (string.IsNullOrEmpty(TxtArSAddrOne.Text.ToString())) { TxtArSAddrOne.Focus(); return("Please enter address one"); } return(ValidateMessage); }