Open new form and closing the old one

Hello, i have a problem with closing one form and opening another one:

Prisijungimas::Hide();
Nuomininkai^ nuomininkaiForma = gcnew Nuomininkai();
nuomininkaiForma->ShowDialog();
The problem here is that when i hide the Prisijungimas form it disappear but it doesn't close itself - it is still running.

Prisijungimas::Close();
Nuomininkai^ nuomininkaiForma = gcnew Nuomininkai();
nuomininkaiForma->ShowDialog();
When i use close function to close the Prisijungimas form it closes it but it doesn't start the following form Nuomininkai.

Nuomininkai^ nuomininkaiForma = gcnew Nuomininkai();
nuomininkaiForma->ShowDialog();
Prisijungimas::Close();
If i try to close form this way it starts the form Nuomininkai and doesn't close the Prisijungimas form.

How should i overcome this?
Registered users can post here. Sign in or register to post.