private void button1_Click(object sender, EventArgs e) { bool check = true; dbUser(); for (int i = 0; i < user.Count; i++) { if (textUser.Text.ToString().Equals(user[i])) { if (textPass.Text.ToString().Equals(pass[i])) { check = false; FirstMain op = new FirstMain(textUser.Text); this.Hide(); op.ShowDialog(); this.Close(); } else { MessageBox.Show("กรุณาใส่ Password ให้ถูกต้อง"); check = false; textPass.Text = ""; break; } } } if (check) { MessageBox.Show("ไม่พบชื่อผู้ใช้ที่ระบุ"); textPass.Text = ""; textUser.Text = ""; } }
private void button1_Click(object sender, EventArgs e) { bool check=true; dbUser(); for (int i = 0; i < user.Count; i++) { if (textUser.Text.ToString().Equals(user[i])) { if (textPass.Text.ToString().Equals(pass[i])) { check = false; FirstMain op = new FirstMain(textUser.Text); this.Hide(); op.ShowDialog(); this.Close(); } else { MessageBox.Show("กรุณาใส่ Password ให้ถูกต้อง"); check = false; textPass.Text = ""; break; } } } if (check) { MessageBox.Show("ไม่พบชื่อผู้ใช้ที่ระบุ"); textPass.Text = ""; textUser.Text = ""; } }