Exemplo n.º 1
0
        private void txtLogin_KeyDown(object sender, KeyEventArgs e)
        {
            string myPatt = "";

            myPatt = pattern + (char)Keys.Back;

            string x = "";

            x = getChar(e).ToString();

            if (myPatt.Contains(x))
            {
                if (e.KeyValue == (char)Keys.Back && user.Length > 0)
                {
                    user = user.Remove(user.Length - 1);
                }
                else
                {
                    user += x;
                }

                if (!login.UserValidate(user))
                {
                    lblLoginValidate.Text = login.userMessage;
                }
                else
                {
                    lblLoginValidate.Text = login.userMessage;
                    e.ToString();
                    txtHaslo.Focus();
                }
            }
        }