melegant Posted March 17, 2003 Posted March 17, 2003 (edited) Lets say I have two forms that I wish to switch back and forth from, until the user is ready to go on to a 3rd Form (My program acts sort of like a wizard) So, In Form1 I have button which Dim frm2 as New Form2() Form2.Show Me.Hide now that I am on Form 2, how to I get back to Form1 from Form2, with all the text boxes still holding the values before I called the Me.Hide method? Thanks! p.s. a thought occured to me, could I pass the form to the next forms constructer? Should I create a Class that houses all my forms as properties? (is that possible?) Edited March 17, 2003 by melegant Quote
*Gurus* divil Posted March 17, 2003 *Gurus* Posted March 17, 2003 Passing the instance to the new form's constructor using the Me (or this) keyword is usually me preferred way of keeping the instances around. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Heiko Posted March 17, 2003 Posted March 17, 2003 I'd chose the way of creating a "WizardManager" class. All of your forms 1 .. n would implement an interface IWizardMember, i.e. a show and a hide method, some events (movenextpressed, movebackpressed, cancelpressed, finishpressed). The WizardManager could keep a list of the forms 1..n, react to the events thrown and make calls to the forms' IWizardMember Interface. Quote .nerd
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.