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

  • From: "Jacob Kruger" <jacobk@xxxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Tue, 27 Oct 2009 23:42:52 +0200

Will try the onChange one out, but the problem is the contents of the textbox won't really change as such since it's a version of hotkey I want to catch as such.


Fact is I want the user to be able to do something like Alt + E to edit the tag/label/name of the text box, or Alt + T to be able to 'trash' it, and remove it from the sort of dynamic layout.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Homme, James" <james.homme@xxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Tuesday, October 27, 2009 6:07 PM
Subject: [program-l] Re: Binding key down event to dynamically generated textbox


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

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4545 (20091026) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4549 (20091027) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



** 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: