public CustomDialog(object formObj, string str) { InitializeComponent(); parentForm = formObj as MainFormAdmin; preValue = str; }
private void Enter_button_Click(object sender, EventArgs e) { bool correct = false; foreach (User user in UserArray) { if (user.Login == Login_textBox.Text && user.Password == Password_textBox.Text) { Hide(); if (user.Login == "admin") { MainFormAdmin form = new MainFormAdmin(this); form.Show(); } else { MainForm form = new MainForm(this); form.Show(); } correct = true; Login_textBox.Clear(); Password_textBox.Clear(); break; } } if (!correct) { MessageBox.Show(@"Login and password doesn't match."); Password_textBox.Clear(); } }