public void clearPasswords() { PasswordTB.Password = ""; PasswordChkTB.Password = ""; PasswordTB.Focus(); Keyboard.Focus(PasswordTB); }
private void LoginTB_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter || e.KeyChar == (char)Keys.Tab) { PasswordTB.Focus(); } if (e.KeyChar == (char)Keys.Escape) { Exit_Click(Exit, null); } }
private void Login_Load(object sender, EventArgs e) { StyleSM.MetroColorParameters = new DevComponents.DotNetBar.Metro.ColorTables.MetroColorGeneratorParameters(Color.White, Properties.Settings.Default.ColorScheme); SelectedH.FocusHighlightColor = DevComponents.DotNetBar.Validator.eHighlightColor.Custom; SelectedH.CustomHighlightColors = new Color[] { Properties.Settings.Default.ColorScheme, Properties.Settings.Default.ColorScheme, Properties.Settings.Default.ColorScheme }; ProgressCP.ProgressColor = Properties.Settings.Default.ColorScheme; ProgressCP.IsRunning = true; if (Properties.Settings.Default.LoginRemember) { UsernameTB.Text = Properties.Settings.Default.LoginUsername; RememberCB.Checked = Properties.Settings.Default.LoginRemember; PasswordTB.Select(); PasswordTB.Focus(); } }
private void PasswordTB_Enter(object sender, EventArgs e) { if (PasswordTB.Text == "password") { PasswordTB.Clear(); } if (hiddenPass) { PasswordTB.UseSystemPasswordChar = true; } PasswordTB.SelectAll(); PasswordTB.Focus(); passPic.BackgroundImage = Properties.Resources.userPassword2; PasswordLn.BackColor = Color.White; PasswordTB.ForeColor = Color.White; userPic.BackgroundImage = Properties.Resources.userLogin; UserNameLn.BackColor = Color.Black; UserNameTB.ForeColor = Color.Black; //wrongTB.Visible = false; }
public LoginPage(string username = null) { /* * Thread.CurrentThread.CurrentCulture = new CultureInfo("hu-HU"); * Thread.CurrentThread.CurrentUICulture = new CultureInfo("hu-HU"); * LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata( * XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); */ InitializeComponent(); if (username != null) { UserNameTB.Text = username; PasswordTB.Focus(); Keyboard.Focus(PasswordTB); } else { UserNameTB.Focus(); Keyboard.Focus(UserNameTB); } viewModel = FindResource("viewModel") as ViewModels.LoginViewModel; viewModel.SetLoginPage(this); //DataContext = new LoginViewModel(this); }
private void button1_Click(object sender, EventArgs e) { if (CompanyNameTB.Text == "") { CompanyNameTB.BackColor = Color.DodgerBlue; MessageBox.Show("Company Name Is Required", "Please Enter Company Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); CompanyNameTB.Focus(); return; } if (SaloganTB.Text == "") { SaloganTB.BackColor = Color.DodgerBlue; MessageBox.Show("Salogan Is Required", "Please Enter Salogan", MessageBoxButtons.OK, MessageBoxIcon.Warning); SaloganTB.Focus(); return; } if (AddressTB.Text == "") { AddressTB.BackColor = Color.DodgerBlue; MessageBox.Show("Address Is Required", "Please Enter Address", MessageBoxButtons.OK, MessageBoxIcon.Warning); AddressTB.Focus(); return; } if (ContactTB.Text == "") { ContactTB.BackColor = Color.DodgerBlue; MessageBox.Show("Contact Number Is Required", "Please Enter Number", MessageBoxButtons.OK, MessageBoxIcon.Warning); ContactTB.Focus(); return; } if (EmailTB.Text == "") { EmailTB.BackColor = Color.DodgerBlue; MessageBox.Show("Email Is Required", "Please Enter Email", MessageBoxButtons.OK, MessageBoxIcon.Warning); EmailTB.Focus(); return; } if (WebsiteTb.Text == "") { WebsiteTb.BackColor = Color.DodgerBlue; MessageBox.Show("Website Is Required", "Please Enter Website", MessageBoxButtons.OK, MessageBoxIcon.Warning); WebsiteTb.Focus(); return; } if (UserNameTB.Text == "") { UserNameTB.BackColor = Color.DodgerBlue; MessageBox.Show("UserName Is Required", "Please Enter UserName", MessageBoxButtons.OK, MessageBoxIcon.Warning); UserNameTB.Focus(); return; } if (PasswordTB.Text == "") { PasswordTB.BackColor = Color.DodgerBlue; MessageBox.Show("Password Is Required", "Please Enter Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); PasswordTB.Focus(); return; } AddRecordMethod(); }
/// <summary> /// checks textboxes for null values /// </summary> /// <returns></returns> private bool CheckTB() { bool result = true; if (String.IsNullOrEmpty(FirstnameTB.Text)) { errorMsg.SetError(FirstnameTB, "Firstname is missing."); result = false; FirstnameTB.Focus(); } else { errorMsg.SetError(FirstnameTB, ""); } if (String.IsNullOrEmpty(LastnameTB.Text)) { errorMsg.SetError(LastnameTB, "Lastname is missing."); result = false; LastnameTB.Focus(); } else { errorMsg.SetError(LastnameTB, ""); } if (String.IsNullOrEmpty(usernameTB.Text)) { errorMsg.SetError(usernameTB, "Username is missing."); result = false; usernameTB.Focus(); } else { errorMsg.SetError(usernameTB, ""); } if (String.IsNullOrEmpty(PasswordTB.Text)) { errorMsg.SetError(PasswordTB, " Password is missing."); result = false; PasswordTB.Focus(); } else { errorMsg.SetError(PasswordTB, ""); } if (String.IsNullOrEmpty(AccessTypeCB.Text)) { errorMsg.SetError(AccessTypeCB, "Access Type is missing."); result = false; AccessTypeCB.Focus(); } else { errorMsg.SetError(AccessTypeCB, ""); } return(result); }