I don’t get it why my Log in form is not closing or hiding even though I am already using the “this.Hide, I am trying to close the from then opening another one, the second form is opening but the Log in is still there running why is that?
here is my code
public void verifyAccount()
{
var hashedPassword = getPassword();
var hasher = new Hasher();
hasher.SaltSize = 16;
hasher.CompareStringToHash(txtPassword.Text, hashedPassword);
if (!hasher.CompareStringToHash(txtPassword.Text, hashedPassword))
{
MessageBox.Show("Invalid UserName or Password");
}
else
{
MainWindow main = new MainWindow();
main.ShowDialog();
this.Hide();
}
}
EDIT: With the peoples comment I found an Idea of how will I close the log in form, here’s my workaround
MainWindow main = new MainWindow();
this.Hide();
main.ShowDialog();
this.Close();
main.ShowDialog();is a blocking call. Control will not run to the next line until you close the main window.