//Login Teacher private bool Log_In_Teacher() { //Check is Textboxes are empty if (string.IsNullOrEmpty(TB_Username.Text) || string.IsNullOrEmpty(TB_Password.Text)) { MessageBox.Show("The username or password was not filled"); } //If textboxes arent empty else { DBRepository DB = DBRepository.GetInstance(); var LoggedIn = DB.FindLoginData(TB_Username.Text, TB_Password.Text, "Teacher"); if (LoggedIn == true) { //Hide the current form this.Hide(); //Make instance of new form var Teacher_Screen = new Teacher_Options(TB_Username.Text); Teacher_Screen.Closed += (s, args) => this.Close(); //Open new form Teacher_Screen.Show(); //Return true return(true); } } return(false); }
/// <summary> /// Btn that returns to the previous form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_back_Click(object sender, EventArgs e) { //Close the current form this.Hide(); //Open instance of another form var Teacher_Screen = new Teacher_Options(); //Open the new form Teacher_Screen.Closed += (s, args) => this.Close(); Teacher_Screen.Show(); }
/// <summary> /// Return to the previous form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_back_Click(object sender, EventArgs e) { //Close current form this.Hide(); //Make new instance of other form var Teacher_Options = new Teacher_Options(); Teacher_Options.Closed += (s, args) => this.Close(); //Open new form Teacher_Options.Show(); }