Getox Posted October 26, 2004 Posted October 26, 2004 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 Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
stustarz Posted October 26, 2004 Posted October 26, 2004 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!) Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
Getox Posted October 26, 2004 Author Posted October 26, 2004 ok, say you click on "Next" i want that to change Form1 to Form2 is that possible? Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
stustarz Posted October 26, 2004 Posted October 26, 2004 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: '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 Quote Visit: VBSourceSeek - The VB.NET sourcecode library "A mere friend will agree with you, but a real friend will argue."
Getox Posted October 26, 2004 Author Posted October 26, 2004 Me.close exits all forms... Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Rick_Fla Posted May 16, 2005 Posted May 16, 2005 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. Quote "Nobody knows what I do until I stop doing it."
AlexCode Posted May 17, 2005 Posted May 17, 2005 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 Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.