private void CardNumber_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            char c = Convert.ToChar(e.Text);

            if (Char.IsControl(c))
            {
                ExpiryDate.Focus();
                return;
            }
            int a = CardNumber.Text.ToCharArray().Where(f => f != ' ').Count();

            if (Char.IsDigit(c) && a <= 15)
            {
                if (a % 4 == 0 && a != 0)
                {
                    CardNumber.Text          += " ";
                    CardNumber.SelectionStart = CardNumber.Text.Length;
                    CardHolderName.Focus();
                    CardNumber.Focus();
                }
                e.Handled = false;
            }
            else
            {
                e.Handled = true;
            }
        }
Exemplo n.º 2
0
 private void SaveMoney_Activated(object sender, EventArgs e)
 {
     CardNumber.Focus();
 }
Exemplo n.º 3
0
 public SaveMoney()
 {
     InitializeComponent();
     CardNumber.Focus();
 }