Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I am trying to capture the CAPS and NUMLOCK keys in an MDI application. I have set the KeyPreview to true and coded the KeyDown event. The problem occurs when a dialog form is being shown. The KeyPreview does not seem to fire when using a dialog form (using ShowDialog()). Is there a way around this without having to add code to every form that is brought up as a dialog form?
Posted
Just off the top of my head, and maybe someone has a better idea, I would make a class with a method that holds the code you want in your KeyDown event. Just call that method from the KeyDown handler on each of the dialogs rather than repeating the whole code.

"Programmers are tools for converting caffeine into code."

 

Madcow Inventions -- Software for the Sanity Challenged.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...