Example #1
0
 private void TxtBxUserName_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         TxtBxPass.Focus();
     }
 }
Example #2
0
        private bool RequiredFieldControl()
        {
            if (string.IsNullOrEmpty(TxtBxUserName.Text.Trim()))
            {
                MessageBox.Show("Please enter your username!",
                                Settings.MessageBoxTitle,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                TxtBxUserName.BackColor = Color.Red;
                TxtBxUserName.Focus();
                return(false);
            }
            else if (string.IsNullOrEmpty(TxtBxPass.Text.Trim()))
            {
                MessageBox.Show("Please enter your password!",
                                Settings.MessageBoxTitle,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                TxtBxPass.BackColor = Color.Red;
                TxtBxPass.Focus();
                return(false);
            }
            else
            {
                return(true);
            }
        }