Пример #1
0
        private void LastNameTb_Leave(object sender, EventArgs e)
        {
            switch (First_Page.opt1)
            {
            case 0:
                if (string.IsNullOrEmpty(LastNameTb.Text))
                {
                    LastNameTb.Focus();
                    errorProvider1.SetError(LastNameTb, "Please Enter Your LastName !");
                }

                else if (!d1.isValidLastName(LastNameTb.Text))
                {
                    LastNameTb.Focus();
                    errorProvider1.SetError(LastNameTb, "LastName must not contain spaces , special characters or numbers !");
                }


                else if (d1.isValidLastName(LastNameTb.Text))
                {
                    errorProvider1.Clear();
                }

                break;

            case 1:
                if (string.IsNullOrEmpty(LastNameTb.Text))
                {
                    LastNameTb.Focus();
                    errorProvider1.SetError(LastNameTb, "Please Enter Your LastName !");
                }

                else if (!p.isValidLastName(LastNameTb.Text))
                {
                    LastNameTb.Focus();
                    errorProvider1.SetError(LastNameTb, "LastName must not contain spaces , special characters or numbers !");
                }

                else if (p.isValidLastName(LastNameTb.Text))
                {
                    errorProvider1.Clear();
                }

                break;
            }
        }
Пример #2
0
 private void SetDefaultValues()
 {
     LastNameTb.Focus();
 }