Question about closing a windows form

wdw

Freshman
Joined
Dec 11, 2002
Messages
37
Hello,

I've got some windows forms, I want to close a form with the Cancel button(alt+c) and then showing the page before the closed page.
now is my problem when i click alt+c my whole application closes, because on all of my forms alt+c is for closing form.
If i click alt+c very carefull i get to the desired page, but when i click to fast my application closes!!!

Does someone have an answer to my question???


greetzz:confused: :confused:
 
Do you mean your want the first form shown to be closed, and a different form shown in its place?

If so your message loop will have to be changed slightly. You'll have to make your startup object Sub Main instead of a form, and write code to run a message loop which doesn't just depend on one form, using Application.Run(). Then, when you need to terminate your app, call Application.Exit() to shut down that message loop.
 
dejota6, yes it would if he has his message loop set up properly.

By default the startup object is set to one form, and as soon as that form closes your message loop is stopped so your application will quit.
 
All Windows programs with a user interface need a message loop that listens for the messages Windows sends to all the windows in your application.
 
Back
Top