I've been able to do the whole database part of the login form, so if the user enters login / password with data that is in the database, he can access.
But when I open the other form, the login does not close and the most I could do was hide it with this.visible = false;
I want the second form to open and the login to close without the whole application crashing, since with this.close () / close () everything would close!
My login button code looks like this:
Note: "access" is a Boolean variable that I assign when I was creating the login part with login / password of the program database.
if (acessar == true)
{
MessageBox.Show("Logado com sucesso!");
this.Visible = false;
Form2 novaform = new Form2();
novaform.ShowDialog();
}
else
{
MessageBox.Show("Erro ao logar");
}