When I open my application I have the first form which opens as the Register form. When I press the Activate Button I want the MAIN form to open and I am using the code below as the last two line:

Main.ShowDialog()
Me.Close()

When the main form opens the Register form does not close and stays background.

If I close:

me.close()
main.showdialog()

then the whole application closes.

Any help on this matter?