private void backBtn_Click_1(object sender, EventArgs e) { studentForm sf = new studentForm(loginlogin); sf.Show(); this.Hide(); this.Close(); }
private void loginButton_Click(object sender, EventArgs e) { string login = loginField.Text; string password = passwordField.Text; bool teacher = false, student = false; using (StreamReader database = new StreamReader("Users/database.txt")) { for (; !database.EndOfStream;) { if (login == database.ReadLine() && password == database.ReadLine()) { // 1 - пользователь учитель if (database.ReadLine() == "1") { database.Close(); teach tf = new teach(login); tf.ShowDialog(); this.Hide(); break; } // 2 - пользователь ученик else { database.Close(); studentForm sf = new studentForm(login); sf.ShowDialog(); this.Hide(); break; } } else { database.ReadLine(); if (database.EndOfStream) { MessageBox.Show("Error"); } } } database.Close(); } }