moving in windows form by keyboard ENTER key
-
frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???
-
frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???
Why not Keys.Enter? Check out the documentation[^] on the Keys Enumeration.
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???
Plus that is pretty non-standard - Enter works the default key, normally OK. Why not use TAB like almost every other windows app since V2.0? Standards, dontcha jest lurve em?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
frnds, how to move focus of one component(textbox, date picker, combo...) to other component. with ENTER key? i tried key press with ..... code private void txtAppfrmNo_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)13) { MessageBox.Show("to next box"); } } ****************************************************************** this.txtAppfrmNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtAppfrmNo_KeyPress); **************************************************** its not working, where is the problem???
I agree with first two answers. Does it have to be the Enter key? Using the Tab key with
TabIndex
to indicate a specific indexing of controls is easier and more standard. Enter will cause a Submit on the form?Regards, Gary
modified on Tuesday, June 23, 2009 9:21 PM