Hi
I have a very strange problem about my Key Press event never get fired in
the VS2005.
I have a parent form and a user control. In my user control, I add two text
box. I also set two hot key for this two textbox. What I want to do is when
the user press the hot key(eg, Alt+E) then the specific textbox will get the
focus.
But my problem this does not work at all, I have tried the keypress event ,
and also tried to overrided the onKeyPress event for both my user control
and my parent form.

Can anyone give me some info what is going on here?

Re: Key Press Event Never Get Fired!! by Morten

Morten
Fri Sep 22 00:39:44 CDT 2006

Hi Victor,

Try setting KeyPreview =3D true for the parent form, or if all fails, =

override PreProcessMessage.


On Fri, 22 Sep 2006 05:45:36 +0200, Victor <shigang1 21cn <"com>"> wrote=
:

> Hi
> I have a very strange problem about my Key Press event never get fired=
in
> the VS2005.
> I have a parent form and a user control. In my user control, I add two=
=

> text
> box. I also set two hot key for this two textbox. What I want to do is=
=

> when
> the user press the hot key(eg, Alt+E) then the specific textbox will g=
et =

> the
> focus.
> But my problem this does not work at all, I have tried the keypress =

> event ,
> and also tried to overrided the onKeyPress event for both my user cont=
rol
> and my parent form.
>
> Can anyone give me some info what is going on here?
>
>



-- =

Happy Coding!
Morten Wennevik [C# MVP]

Re: Key Press Event Never Get Fired!! by Stoitcho

Stoitcho
Fri Sep 22 10:37:00 CDT 2006

Victor
How do you set the hotkeys? Can you post some sample code?


--
HTH
Stoitcho Goutsev (100)


"Victor" <shigang1(-at-)21cn(-dot-)com> wrote in message
news:epAA33f3GHA.1464@TK2MSFTNGP03.phx.gbl...
> Hi
> I have a very strange problem about my Key Press event never get fired in
> the VS2005.
> I have a parent form and a user control. In my user control, I add two
> text box. I also set two hot key for this two textbox. What I want to do
> is when the user press the hot key(eg, Alt+E) then the specific textbox
> will get the focus.
> But my problem this does not work at all, I have tried the keypress event
> , and also tried to overrided the onKeyPress event for both my user
> control and my parent form.
>
> Can anyone give me some info what is going on here?
>