/// <summary> /// This method invokes a method having a regular expression that validates the format of the entered Bank Account Number. /// </summary> /// <param name="sender">The control that fired the event</param> /// <param name="e">The arguments associated with the fired event.</param> private void accountNumber_Validating(object sender, CancelEventArgs e) { string textInput = accountNumber.Text.TrimStart().TrimEnd(); if (string.IsNullOrEmpty(textInput)) { MessageBox.Show("No account number has been entered", "Salary Slip Application", MessageBoxButtons.OK, MessageBoxIcon.Error); accountNumber.Focus(); } else if (!(RegularExpressionValidator.IsValidAccountNumber(textInput))) { MessageBox.Show("The entered account number is not in proper format", "Salary Slip Application", MessageBoxButtons.OK, MessageBoxIcon.Error); accountNumber.Focus(); } }