dim Form2 as new Form2 Form2.Show() Me.Close()
Doing this however shuts down BOTH forms? Thanks.
Before I answer this, I just want to point out that in nearly all cases, applications that are switching forms on the user is not a good design. For one, it's confusing to the user, and as you can tell, it really isn't something that's supported by the .NET Framework (or any framework for that matter). However, I do not know the particulars of your application, so you may have a case where this makes perfect sense.
By calling Me.Close() on Form1, you are telling the application to end its main thread, which ends the entire application. What you'll need to do is call Me.Hide() instead to hide the main form and let Form2 continue running as a modaless window. The problem is that when you close Form2, your application will continue to run because there's no automatic way to have the main form end when all modaless windows are closed. What you'll need to do is implement a way to pass an instance of Form1 to Form2. When Form2's Close method, which you'll need to override, is called, you can call Form1's close method.
This was first published in April 2004