Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compact Framework: Closing a form 2

Status
Not open for further replies.

hitechboy78737

Programmer
Nov 8, 2004
82
US
This is probably a basic question... but how on earth do I close a win form when opening another within the same application, using the compact framework?

I have tried this:
Code:
dim f as new frm_main
f.show
me.close

This SEEMS to open the new form, but then closes the application...

What am I missing here?

Thanks!
Kevin Howell

 
You close the object that has created the form. And when that object is closed the object within goes away as well.

Two options I know of, but theres probably better ones.

1. Manage your forms from a module.

2. Use f.showdialogue(), which keeps focus on the new form and performs me.close on the first object when f is closed or returns a dialogueresult


- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
 
Thank you Smurf. I also discovered that the "x" in the upper right hand corner doesn't work like it does in windows applications... surprise!

Am I mistaken that this (the object closing the created object) behaviour different than with a desktop project? I seem to recall being able to close the first form after opening a second.
 
Nope, closing the startup object ends the application. If you need to close the initial form you should switch your startup object to a module and control the form sequence from there.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top