cpopham Posted June 29, 2004 Posted June 29, 2004 I have a multi form program. I can open the new forms with no problems. But I want to close the current form when the new form opens. When I use me.close(), it closes everything. I do not need to keep the form open and just hide it, I want to release the resources and just close that form. I have searched and still have not found a good way of doing this. Anyone know how? Thanks, Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Administrators PlausiblyDamp Posted June 29, 2004 Administrators Posted June 29, 2004 If you close the main form for the application you effectively terminate the windows message loop. You need to tell .Net that another form should process messages and keep the application running. i.e. 'In the current main form dim f as new form1() f.show application.run(f) me.close(); Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
cpopham Posted June 29, 2004 Author Posted June 29, 2004 Okay thanks... Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
cpopham Posted June 29, 2004 Author Posted June 29, 2004 Okay I tried it and it gives me the following error: It is invalid to start a second message loop on a single thread. Use Application.RunDialog or Form.ShowDialog instead. What would happen if I used subMain to declare my form abojects as public? Coul I then close them when needed without affecting other forms or what is wrong with that code. I put in exactly how you described. Chester Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
kejpa Posted June 29, 2004 Posted June 29, 2004 I have a multi form program. Why not use a MDI-form and have your forms as MDI-childs? /Kejpa Quote
Administrators PlausiblyDamp Posted June 29, 2004 Administrators Posted June 29, 2004 Should work from a sub main without any problems. Also is there any reason why you need to change the main form while the application is running? Could you not just use the other form as a startup object? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
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.