Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

  • Administrators
Posted

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();

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...