About close program problem

  • Thread starter Thread starter Alan Ho
  • Start date Start date
A

Alan Ho

Dear All,
i used some close program method, e.g. this.hide(), this.dispose() or
this.close() ,
for above 3 method I dont know why i can't open the program in PPC again.
and i dont want to use Application.exit() method, becase i use this method
my program will hang on, does anyone has idea?
thanks!
 
Alan:

Are you using each method from the main form? It's possible that you are
closing another form, while the main one is still minimized. If you check
the memory -> running programs, is the program listed?

The reason I ask is that if you call .close from the main form, you should
be fine. If not, let me know and I'll see what I can come up with.

Cheers,

Bill
 
If Exit causes a hang, then I'm guessing it's a bug in your code. I'd also
venture to uess you have a thread running at that point, so you need to kill
all child threads before exiting.

-Chris
 
Dear Alan,

There is a statement in your code as following.
Application.Run(new form1())
That means form1 is the startup object of your program.

You might use
form2.Show()
form1.Hide()
to switch to another form (form2).
However, if you only use form2.Close() after switching,
then you can never see your program, but your program
doesn't end because form1 is still running.

My suggestion is use following code in form1,
form2.Show()
form1.Hide()
And the following code in form2,
form1.Show()
form2.Hide()
When you want to end your program ,
use form1.Close() in form1.
That will really close the startup object, and stop your program.

--
Best Regards,
Jan Yeh

eMVP, MCAD, .NETcf Developer
Mobile Mind Company @ Taiwan
 
Back
Top