Example #1
0
        //log in button
        //if username is Joe and password is Password123 hide the login form and show the staff view form

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "Joe" && textBox2.Text == "Password123")
            {
                this.Hide();
                var newForm = new Staff_View();
                newForm.Show();
            }
            else
            {
                //otherwise if the username is Admin and the password is Password123 hide login form and show admin view form

                if (textBox1.Text == "Admin" && textBox2.Text == "Password123")
                {
                    this.Hide();
                    var newForm = new Admin_View();
                    newForm.Show();
                }
                //if what ever is typed out in the username and password box doesn't match one of the usernames and password stated above, show a message saying "Invalid Login"
                else
                {
                    MessageBox.Show("Invalid Log In");
                }
            }
        }
Example #2
0
        //when back button is clicked, hide staff form and show admin view form
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            var newForm = new Admin_View(conString);

            newForm.Show();
        }