FoxPro Programming
reading pdf417 barcode data into a form control
Gravatar is a globally recognized avatar based on your email address. reading pdf417 barcode data into a form control
  Robert
  All
  Nov 19, 2019 @ 09:50am

Hello, I am trying to read a PDF417 bar code into an edit box control on a form. However, the data comes in as a single line. When I scan the same bar code into a notepad I get many line feeds.

Does West Wind offer any form level controls that would allow for the scanning of a PDF417 2-D type bar code?

Gravatar is a globally recognized avatar based on your email address. re: reading pdf417 barcode data into a form control
  Tore Bleken
  Robert
  Nov 20, 2019 @ 02:41am

A Carriage Return (CR, chr(13)) is usually not "alone" in a file, often it's combined with a Line Feed (LF), chr(10)). And different programs treats a "lonely" CR differently. Some programs will show lines on top of each other, some will show lines after each other and some will show lines as separate lines.

Try to add a LF to every CR and see if that fixes it. Something like this will do the job:

yourEditBox.value = strtran(yourEditBox.value, chr(13), chr(13)+chr(10))

If this fixes you problem, I'm pretty sure that the bar code reader can be programmed to add the LF automatically.

Gravatar is a globally recognized avatar based on your email address. re: reading pdf417 barcode data into a form control
  Robert
  Tore Bleken
  Nov 21, 2019 @ 10:42am

Thank you for the suggestion Tore Bleken. But I tried all kinds of variations of that without success. Both at the scanner level and in VFP logic like you suggested. I suspect the PDF417 has control codes that a VFP text box does not know what to do with. If I read the same PDF417 from a file into a string. (e.g. filetostr()) then it works fine.

I ended up creating a simple C# project. The C# form has a text box just like my VFP form did. But, the C# text box handles the incoming data from the scanner just fine. Very strange.

Gravatar is a globally recognized avatar based on your email address. re: reading pdf417 barcode data into a form control
  Tore Bleken
  Robert
  Nov 21, 2019 @ 11:36am

I'm glad you solved your problem.

© 1996-2024