noodlesoup Posted August 18, 2007 Posted August 18, 2007 (edited) I have create 2 form within my C# project. form1 is named login. form2 is named main. login form is used to verify username and password. once the username and password is verified, login form will terminate and call form2 to enter the main screen. I am having trouble calling form2. Anyone know how to do this within Visual Studio C++? Edited August 18, 2007 by noodlesoup Quote
davearia Posted August 20, 2007 Posted August 20, 2007 Dim thingy As New whateverTheOtherFormIsCalled thingy.ShowDialog() Quote
Leaders snarfblam Posted August 20, 2007 Leaders Posted August 20, 2007 I personally wouldn't recommend this technique. It would probably work, but it prevents the login form from being properly disposed and might cause obscure errors or problems down the road. Multiple forms like this should be managed with the Application class. The simplest way to do this would probably be to duplicate the Application.Run in your Main() and specify the second form. The login data should probably be stored in your Program class or passed on to your main form. Your main should probably look something like this: /// <summary> /// The main entry point for the application. /// </summary> [sTAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); login loginForm = new login(); Application.Run(new loginForm()); // Place code to manage login data here Application.Run(new main()); // (or whatever your main form's class is called) } Quote [sIGPIC]e[/sIGPIC]
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.