Example #1
0
        private void textBox2Bkash_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
                PhoneerrorProvider.SetError(this.textBox2Bkash, "Only Numeric value is valid as Account number");
            }
            else if (textBox2Bkash.Text.IndexOf("0") == 0)
            {
                if (textBox2Bkash.Text.Count() >= 3)
                {
                    if (textBox2Bkash.Text != "017" || textBox2Bkash.Text != "018" ||
                        textBox2Bkash.Text != "019" || textBox2Bkash.Text != "016" ||
                        textBox2Bkash.Text != "015")
                    {
                        BkasherrorProvider.SetError(this.textBox2Bkash, "Invalid Phone Number");
                    }
                }
            }
            else if (textBox2Bkash.Text.IndexOf("0") != 0)
            {
                if (textBox2Bkash.Text.Count() == 3)
                {
                    if (textBox2Bkash.Text != "17" || textBox2Bkash.Text != "18" ||
                        textBox2Bkash.Text != "19" || textBox2Bkash.Text != "16" ||
                        textBox2Bkash.Text != "15")
                    {
                        BkasherrorProvider.SetError(this.textBox2Bkash, "Invalid Phone Number");
                    }
                }
            }
            else
            {
                this.BkasherrorProvider.Clear();
                bkashaccNoValidation = 0;
                this.Refresh();
            }

            if (textBox2Bkash.Text != null)
            {
                AmountPaytextBox.Enabled = true;
            }
            if (textBox2Bkash.Text.IndexOf("0") == 0)
            {
                textBox2Bkash.Text = textBox2Bkash.Text.Remove(0, 1);
            }
        }
Example #2
0
 private void textBox2Bkash_Leave(object sender, EventArgs e)
 {
     if (textBox2Bkash.Text == string.Empty)
     {
         AmountPaytextBox.Text    = "0";
         AmountPaytextBox.Enabled = false;
     }
     if (textBox2Bkash.Text.Length != 10)
     {
         BkasherrorProvider.SetError(textBox2Bkash, "Invalid Phone Number");
     }
     else if (textBox2Bkash.Text.Substring(0, 2) != "17" && textBox2Bkash.Text.Substring(0, 2) != "18" &&
              textBox2Bkash.Text.Substring(0, 2) != "19" && textBox2Bkash.Text.Substring(0, 2) != "16" &&
              textBox2Bkash.Text.Substring(0, 2) != "15")
     {
         BkasherrorProvider.SetError(this.textBox2Bkash, "Invalid Phone Number");
     }
     else
     {
         this.BkasherrorProvider.Clear();
         bkashaccNoValidation = 0;
         this.Refresh();
     }
 }