views:

48

answers:

2

My custom Control displays a TextBox when a key is pressed (basically to allow for numeric input). It's easy enough to show the TextBox from inside the KeyDown event on the main control, but how do I pump the keypress into the textbox?

A: 

Why dont you keep a buffer ( a variable) to store the value of KeyPress and after the TextBox is Enabled, update the value?

abhishek
What do you mean by "update the value"?
David Rutten
A: 

You can use the KeyValue of the KeyEventArgs parameter (sent to the method handling the keydown event of your user control).

Using that you can send the first key to the textbox and then move the focus to the textbox like suggested before.

Hope I understood you well.

Neowizard