Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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)?
Posted

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.

Posted

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!

  • *Experts*
Posted

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.

:)

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...