[program-l] Re: Binding key down event to dynamically generated textbox

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: "program-l@xxxxxxxxxxxxx" <program-l@xxxxxxxxxxxxx>
  • Date: Tue, 27 Oct 2009 12:07:48 -0400

Hi Jacob,
I'm not understanding. What do you want to happen when you use on key down? 
Maybe you really want to use the on change event. That happens in a text box 
every time you type and delete stuff. You could check for the needed strings in 
the value properties and react to them with the on change event.

Jim

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Jacob Kruger
Sent: Tuesday, October 27, 2009 8:51 AM
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Binding keydown event to dynamically generated textbox

Ok, next question.

If I dynamically create and place textbox controls on my form, within a tab 
control, they don't seem able to capture the keydown event, which the combo 
boxes created in the similar routine are fine with?

If I drop a standard textbox on a windows form during design, I can then quite 
easily capture it's keydown event, but for some reason this doesn't seem to 
want to work on my runtime generated textboxes, but I want to be able to also 
catch the necessary keystrokes to be able to 'trash' the currently focused 
textbox, using something like a key combo of Alt + T, but I just hear the 
invalid sound when I hit that keystroke in there?

I am using the same basic code to link their events to my subroutine:
ctlTB.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textbox_KeyDown);

Stay well

Jacob Kruger
jacob.kruger@xxxxxxxxxxxx


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq


This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed.  If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it.  If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
 The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: