Hi all
i have a text box used for entering data using a bar code scanner,
when the bar code scanner enter data to the text box the cursor jumps to the next text box , i want the cursor stays in the current text box and select all text inside the text box after the bar code scanner enter data to it.
how to achieve this, please
regards
how to set focus and select text inside text box
-
- BronzeLounger
- Posts: 1267
- Joined: 01 May 2016, 09:58
-
- Administrator
- Posts: 78620
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to set focus and select text inside text box
The scanner software usually has an option to insert an Enter after scanning a code. See if you can turn this off.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1267
- Joined: 01 May 2016, 09:58
Re: how to set focus and select text inside text box
can we make a trick, by creating another text box and set the tab order in order the mouse cursor goes to the new text box ... and when the new text box is set focus ... move the cursor back to the txtSearch text box?
-
- Administrator
- Posts: 78620
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: how to set focus and select text inside text box
You can use the On Got Focus or On Enter event for this:
Make sure that TextBox2 comes immediately after TextBox1 in the Tab Order of the form.
Code: Select all
Private Sub TextBox2_GotFocus()
Me.TextBox1.SetFocus
End Sub
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1267
- Joined: 01 May 2016, 09:58
Re: how to set focus and select text inside text box
thanks a lot , that's worked more than what i was expected.