clg Posted September 5, 2003 Posted September 5, 2003 Can someone tell me how to configure my windows form or control so that when I press enter I navigate from control to control (like tab)? Quote
*Experts* Volte Posted September 6, 2003 *Experts* Posted September 6, 2003 Me.SelectNextControl() will focus the next TabIndex in line. Quote
clg Posted September 6, 2003 Author Posted September 6, 2003 Thanks, but still confused! Thanks for the reply, but I'm afraid I'm still confused! Where should I put this statement? I'll try to be more specific, I have a text box on my form whose purpose is to accept a barcode from a barcode scanner. It will accept the barcode alright but I need to leave the textbox so that I can fire the LEAVE event and process the information. If after scanning the barcode, the user hits the TAB key the event will fire. I would like to make it possible for the user to press the ENTER key to activate the LEAVE event. I can also configure my scanner to have a TAB suffix which also fires the LEAVE event. This is good, but I need to deal with many different users and different barcode scanners -- I think many barcode scanners come preconfigured with a Carriage Return suffix. If I can get the textbox to LEAVE when it encounters an ENTER then I think it will also LEAVE when it encounters the Carriage Return suffix. This would allow the user to continue scanning without stopping to touch the keyboard to hit TAB. Quote
clg Posted September 6, 2003 Author Posted September 6, 2003 Found a solution Found a solution. Put this code in the KEYDOWN event If e.KeyCode = Keys.Enter Then TextBox1.Focus() End If Textbox1 is a dummy textbox that will be invisible. The most important thing is that it will now trigger the LEAVE event and process my data whether the user has configured a TAB suffix or an ENTER suffix into his barcode scanner -- or if he just hits ENTER or TAB on the keyboard. Thanks for your interest! Quote
*Experts* mutant Posted September 6, 2003 *Experts* Posted September 6, 2003 You dont need a dummy control, if you have other controls on your from then what VolteFace showed you will work instead of of focusing a dummy control. :) Quote
clg Posted September 7, 2003 Author Posted September 7, 2003 Thanks for the info. Your solution is cleaner -- I just didn't know where to put that statement until I learned about the KEYDOWN event. Thanks again folks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.