コード例 #1
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (back == 5)
     {
         FrmTestSetup ts = new FrmTestSetup();
         ts.Show();
         this.Hide();
     }
     else if (back == 1)
     {
         FrmLogin lg = new FrmLogin();
         lg.Show();
         this.Hide();
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Thato-Nameng/Multiple-Choice
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //using if else statements to give nstrutions on what the user has selected and requests password and name to login
            if (cbUser.SelectedIndex == 0 && tbName.Text.Equals("Login") && tbPassword.Text.Equals("12345678"))
            {
                //opening another form
                FrmTestSetup fts = new FrmTestSetup();
                this.Hide();
                fts.Show();
            }
            else
            {
                //else statement and boolean for incorrect statements entered
                bool found = false;
                int  x     = 0;
                string[,] array = fu.getStudentList();
                //using a while loop for statements that found true the loop can execue
                while (x < 5 && found == false)
                {
                    //using an array that has 3 columns
                    if (array[x, 1].Equals(tbName.Text) && array[x, 3].Equals(tbPassword.Text))
                    {
                        // taking information from the class and the file

                        found = true;
                        //opening another form
                        frmTakeTest ftt = new frmTakeTest(x, array);
                        this.Hide();
                        ftt.Show();
                    }



                    x++;
                }
                //ef else statements to display message if anythhing found false
                if (found == false)
                {
                    MessageBox.Show("was not able to match name and password  ");
                }
            }
        }