Exemple #1
0
 private void logoutButton_Click(object sender, EventArgs e)
 {
     Form f = this.FindForm();
     f.Controls.Remove(this);
     LoginScreen ls = new LoginScreen();
     HomePage hp = new HomePage();
     f.Controls.Add(ls);
     ls.Location = new Point((f.Width - ls.Width) / 2, (f.Height - ls.Height) / 2);
 }
Exemple #2
0
        //Button Click
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (usernameText.Text == username && passwordText.Text == password)
            {
                Form f = this.FindForm();
                f.Controls.Remove(this);

                HomePage hp = new HomePage();
                f.Controls.Add(hp);

                hp.Location = new Point((f.Width - hp.Width) / 2, (f.Height - hp.Height) / 2);
            }
            else
            {
                label1.Text = "Login information incorrect";
                usernameText.Text = String.Empty;
                passwordText.Text = String.Empty;
            }
        }