Link to home
Start Free TrialLog in
Avatar of dmarco
dmarcoFlag for Italy

asked on

KeyPress event in a MDI-parent form

Hi friends,

I'm working at a MDI project, where the starting object is the MDI-parent form. Sometimes I need to stop the program AFTER loading the MDI-parent form and BEFORE loading the MDI-child form(s). This could be done simply using a MsgBox that prompts the user:  "Do you want to stop the program? y/n". However, this doesn't seem me the best solution. It would be better to stop the program execution pressing a key, but unfortunately the MDI-parent form hasn't a keyPress event ... How can I do?
It must be said that in my code the formLoad event of the MDI-parent form loads the MDI-child form.
ASKER CERTIFIED SOLUTION
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot to say that the Sub Main can startup the MDI form.

Avatar of dmarco

ASKER

thanks, I need some time to check your suggestion...
Avatar of dmarco

ASKER

OK, GetKeyState function works.
 
I declared it in the module of my project and I called it directly in the form_Load event of the MDI form. Therefore there is no need to change the "startup object".

Thanks for help.
Marco.