Hi,
I have this code in my form constructor:
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.onKeyPress);
and below after the constructor I have this one:
private void onKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
textBox1.Text = "uuuuu";
}
and it does not work...
Why, it seems all ok in the code?
Regards,
Mirza
Loading
Jan MontanoPosted Aug 30, 2007, 1:46 AM
Try creating a plain form with the keypress eventhandler (with no other controls in it ) except that you'll display a messagebox instead inside the onkeypress method. it should work. But try placing a textbox insdie the form and it will not work. The reason is, the focus will be on the textbox when you run the application.