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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! Form KeyUp, KeyDown, KeyPress Events will not fire...

Status
Not open for further replies.

evasyar

Programmer
Oct 31, 2002
8
0
0
US
I have a Form that launches a another Form as modal(.Show vbModal). Now on the loaded modal form, the control box is disabled, and there are no buttons with click events with code "Unload Me", instead I was using this form's KeyDown or KeyUp or KeyPress events then with a select statement, evaluates the KeyAscii parameter if it is an "F12" (vbKeyF12 enum) and if the condition is true then unload the modal form. The problem is, it is not triggering these events (modal form's KeyUp, KeyDown, KeyPress events) once I press the "F12" key, which what I think should be captured once these events are triggered, these events do not fire at all. Is there something else that I needed to do besides entering the code in these events? If this is not possible, is there some other work-arounds?

What I have done thus far is dock a container control in the modal form (ie., PictureBox, Image, Frame) then using its KeyUp, KeyDown, or KeyPress events. This one seems to work since the default focus would be on the container control, but once I lose focus on the container control, I lose those triggered events hence my work-around is shot. Any other suggestions greatly appreciated.
 
Have you tried setting the forms KeyPreview property to true - this will force the form to action key presses before a control see them - or words to that effect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top