private void FLogin_Activated(object sender, EventArgs e) { if (Properties.Settings.Default.loginsaveusername) { TbPassword.Focus(); TbPassword.ForeColor = Color.Black; TbPassword.Text = string.Empty; TbPassword.PasswordChar = '*'; } else { TbUsername.Focus(); } }
private void TbUsername_TextChanged(object sender, EventArgs e) { // On change up of the textbox string UsernameValue = TbUsername.Text; // Create a string with the value of the TbUsername value if (UsernameValue == "") { // If the username textbox is empty UsernameValid = 1; // Set the usernamevalid to 1, which disables the user from selecting a difficulty TmrPopUp.Start(); LblPopUp.Visible = true; // Display the popup text LblPopUp.Text = "Please enter a username. Remember no numbers allowed!"; } else { // The username is not empty UsernameValid = 0; // Set the usernamevalid to 0, which enables the user to select a difficulty } for (int i = 0; i < UsernameValue.Length; i++) { if (!char.IsLetter(UsernameValue[i])) { // If the current character is not a letter TbUsername.Clear(); // Remove all characters in the username textbox TbUsername.Focus(); // Focuse the user onto the username textbox to set the user to editing the username UsernameValid = 1; // Set the usernamevalid to 1, which disables the user from selecting a difficulty TmrPopUp.Start(); LblPopUp.Visible = true; // Display the popup text LblPopUp.Text = "Remember no numbers allowed!"; } else { UsernameValid = 0; // Set the usernamevalid to 0, which enables the user to select a difficulty } } }
private void Window_Activated(object sender, EventArgs e) { TbUsername.Focus(); CpldSocket.CpldSocket.ReceiveTimeout = 5000; CpldBase.ThreadFlags.ConnStatCheck = true; }