private void Exitbtn_Click(object sender, EventArgs e) { MenuLogistic frm = new MenuLogistic(); frm.Show(); this.Hide(); }
private void btnLogin_Click(object sender, EventArgs e) { if ((txtUser.Text.Length == 0) || (txtPassword.Text.Length == 0)) { MessageBox.Show("Username and Password Cannot be Empty"); } else { FileStream fs = new FileStream("LoginAdmin.txt", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); string[] file = File.ReadAllLines("LoginAdmin.txt"); foreach (string dataLogin in file) { var ArrLog = dataLogin.Split('~'); if ((ArrLog[0].Contains(txtUser.Text)) && (ArrLog[1].Contains(txtPassword.Text))) { MenuLogistic frm = new MenuLogistic(); frm.Show(); this.Hide(); } else { MessageBox.Show("Username or Password invalid !"); } } } }