i want to develop typing tutor application for kids
but there are proble how to handle key from key board
like enter key and other inputs
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shweta LodhaPosted Feb 3, 2014, 3:10 PM
private void Form1_Load(object sender, System.EventArgs e) { // Set these when the form loads: // Have the form capture keyboard events first. this.KeyPreview = true; // Assign the event handler to the form. this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); // Assign the event handler to the text box. this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown); } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Alt && e.KeyCode.ToString() == "F") { // When the user presses both the 'Alt' key and 'F' key, // KeyPreview is set to False, and a message appears. // This message is only displayed when KeyPreview is set to True. this.KeyPreview = false; MessageBox.Show("KeyPreview is True, and this is from the FORM."); } } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.Alt && e.KeyCode.ToString() == "F") { // When the user presses both the 'Alt' key and 'F' key, // KeyPreview is set to False, and a message appears. // This message is only displayed when KeyPreview is set to False. this.KeyPreview = true; MessageBox.Show("KeyPreview is False, and this is from the CONTROL."); } }