Swaping a form?

Getox

Centurion
Joined
Jul 8, 2004
Messages
122
Is there anyway of swaping a form?

iv tried:
Dim frm As Swap Form2
frm.show()
and
also
frm.swap()

anyone got any ideas?

thanks
 
Cant really undestand what your trying to do, you want to close one form and open another, thats relatively simple: just declare an instance of the new form to open and form.show() it, then me.close the calling form (as long as it isnt the parent in an mdi interface - otherwise you will exit out your entire application!)
 
I see what you mean now, like in the setup wizards you get with applications. Well, 1 way i would do this would be to have 1 form with multiple panels, each panel contains the controls i need visible at any one time, and when pressing next just hide the currently visible panel, and show the next one.

Or alternatively just open the new form, and close the current one:
Visual Basic:
'Replace FormToOpenName with the actual name of the form you want to open
Dim frmToOpen As New FormToOpenName
frmToOpen.show()

'Close the current form
Me.close

I havent tested the above, but im sure u get the idea
 
me.close will close all forms only when calling that from the form that starts-up when the application starts. That can be changed by creating a Sub Main and starting from there.

**edit**
Crap sorry was not looking at how old the post was, was looking for something else and had a brain meltdown.
 
Old post but still worth errors correction...

Rick_Fla: Your way will also end the application.
Any windows Application needs a form to sustain the message loop (what keeps the application alive). So, even if this form is startes on a Sub Main, calling Application.Run or ShowDialog, if you lose it, the application will end...

What you can do is to change the application base form and then you can close the primerelly opened form.

Take a look at my post on this thread: http://www.xtremedotnettalk.com/showthread.php?t=85196&highlight=applicationcontext
(it's the last one) it will show you how to do this...

Alex :p
 
Back
Top