Thanks for your answer, but after investigating a little more I have
discovered that the issue is around mdi forms that I'm using in this
application.
I have a MDI child form that open another MDI child form this way when I
press a button:
private void button1_Click(object sender, System.EventArgs e)
{
fChild2=new frmChild2();
fChild2.MdiParent=this.MdiParent ;
fChild2.Show();
}
When I close this second child form and the first child form recover the
focus, if I got into a textbox of that first child form and press Enter key
the click button event fires instead of the key press event.
I have checked that the focus in in the textbox when I press the Enter.
I have a small project to check the effect.
Is there any explanation?
Thanks for your help again.
Best regards
"ClayB [Syncfusion]" <cl***@syncfusion.com> escribió en el mensaje
news:uT**************@TK2MSFTNGP09.phx.gbl...
Clicking a button gives it input focus. Try adding this.textBox1.Focus()
at the bottom of your button handler to set the input focus back to your
textBox1.
===================
Clay Burch, .NET MVP
Visit www.syncfusion.com for the coolest tools
"Jose Egea" <je***@innovem.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hello:
I'm trying to execute a function when the user press Enter key in a
TextBox. But something is happening in my form because after pressing a button,
when I press the Enter key in the TextBox, the application executes the click
event of the last button selected instead of the keypress event of the
TextBox. Any key event happen in my form, even the keypreview event is
ignored. The propertie AcceptsReturn is set to false and AcceptButton to
none.
I can't understand the reason.
Thanks in advance for your help
Best regards