+ Reply to Thread
Results 1 to 5 of 5

Text appearing in text box in reverse order

  1. #1
    Registered User
    Join Date
    02-26-2017
    Location
    Green Valley, Arizona
    MS-Off Ver
    2015 professional
    Posts
    7

    Text appearing in text box in reverse order

    I have a simple userform with what I think to be a routine textbox. There is a USB barcode scanner attached. When a badge is scanned, the digits appear in the text box in reverse order. I have no idea why this is happening. I did some research on MSDN, and found that there is property RightToLeft for the textbox control. I tried to set this property but VBA does not recognize it. Maybe I need to reference some other library?

    I'm really lost here, and any help getting out of the wilderness will be greatly appreciated.

    tia

  2. #2
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,155

    Re: Text appearing in text box in reverse order

    You could create a second textbox and use code like this in the first box's Change event.
    Please Login or Register  to view this content.
    The scanner would put the reversed barcode in TextBox1. The Change event will reverse that into TextBox2 and the downstream processes could look to TextBox2 for their data. You could even set the .Visible of TextBox1 to False.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    02-26-2017
    Location
    Green Valley, Arizona
    MS-Off Ver
    2015 professional
    Posts
    7

    Re: Text appearing in text box in reverse order

    Sorry, I should have included a bit more info. The application also allows the user to type the code into the textbox, instead of scanning it in. When the user types in the code, the digits appear in the correct order. I'd need a reliable way to detect user entry vs scanner entry. Also, I considered the approach you outline, but focus must be set back to the appropriate box after each code is processed. Cannot set focus to an invisible control.

    tnx

  4. #4
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,155

    Re: Text appearing in text box in reverse order

    In my scenario, the user could type into TextBox2. TextBox1 would be hidden and its only function would be to receive the signal from the bar scanner, reverse it and pass it to TextBox2. And that's all that TextBox 1 would do. Textbox2 would be the one that is visible, and the user types into etc.

  5. #5
    Registered User
    Join Date
    02-26-2017
    Location
    Green Valley, Arizona
    MS-Off Ver
    2015 professional
    Posts
    7

    Re: Text appearing in text box in reverse order

    Problem Solved!
    My application code implements a keydown event to trap and process the incoming characters. Apparently that processing takes too long.
    The scanner (Zebra DS9208) is very programmable. One variable is the delay between characters transmitted to the host. If I program a delay of as little as 20ms, the scanned value is entered into the textbox correctly.

    I do not know why the character string gets reversed without this delay, but I'm going to take this result and smile

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1