Reading Barcodes or QR Codes With Xojo


I would like to write an app where I have an external QR or Bar Code Scanner plugged into a USB port so I could read QR codes into a textbook in Xojo. It would be like an attendance type app in which the user would scan a code and the contents would go into a textbox. The QR code would simply be a first and last name, nothing fancy.

Is there a way I can do this with Xojo? Can do use the Serial Control to do this?

Any help would be appreciated.

Thank you. :slight_smile:


Simply use a scanner device which acts as keyboard replacement. Than you just need a textfield and nothing else.

Most manufacturers of scanners offer units that emulate a keyboard or serial device. The serial device would just show-up on a port. You would use the Serial Control in Xojo to interface with. Once you initialized the port you could use the DataAvailable and ReadAll method to get the data from the buffer.

As Christian mentioned the easiest way is to use a scanner that emulates a keyboard. In that case the user would just scan the code when they are on the text field that you want to capture the data into, it literally is just like typing on the keyboard.

Thank you Christian and Joseph. I appreciate the advice. I actually downloaded an iPhone app that works great, so I am up and running. Thank you so much for taking the time to help. I really appreciate it.


generating a EAN or SSCC barcode isn’t that hard if you have the right manuals from your local GS1.
However generating a QR code to put on your attendance card is a real bugger. I find it easier to just send this

and wait for the response. Works every time and they are quite fast. Just create a simple program to loop through a list and save the returned image to disk. You could even name the image as the attendees full name. Check it with the scanner you will use as the size you can use for the QR code depends a lot on the scanner you use (see below).

if you go to the site you will see the options they have and they give you a link, the QR code can be various sizes and have various duties. For you a text QR code would be the best , you can have up to 1024 characters in a normal QR code so you could go sick if required.

As for reading of them, the above from the lads is correct, use a symbol or data-logic scanner which only does keyboard emulation. You get them on EBay from China for about 20-30 $ each any Laser Barcode Scanner would do the job. However these will only do limited names and you would have you use a Code-39 extended barcode, which will limit you to a few dozen characters, not impossible however much easier with QR codes.

have a look at you can generate your name as a Code-39 extended to see what it will look like.

QR scanners cost a bit more but do exactly the same thing. Something like a Metrologic MS1690 costs about $100 however they are USB and bullet proof if you drop them.

Hope this helps

PS I have no personal or commercial interest in, I just use them and find it simple to use.

[quote=16813:@James Redway]Thank you Christian and Joseph. I appreciate the advice. I actually downloaded an iPhone app that works great, so I am up and running. Thank you so much for taking the time to help. I really appreciate it.


what iPhone app did you use???

as for what you said, it reminds me the barcode reader for qr code i‘m using now. and i recently generate barcode in my iphone, and I wanna generate barcode reader,too,do you guys have any idea?

Generate barcode reader? Why not use a barcode reader on the Internet! It can save you a lot of time.

To generate barcodes, there are also these Xojo classes:

it seems very complete. You can also decode a bar code (QR code…) received by email.

Hi James,
I’m not sure if this QR code control will work with Xojo or not, but no harm giving it a try.


Trisha, did you try the new Barcode plugin from me?

not yet. So i don’t need to use the previous one??? what do i need to do to use your new one included in the MBS Plugin?

Well, maybe you download 13.5pr7 on the website here:

and than you try and check the examples.

In general it may difficult to get clear, sharp and cropped images for the scan. So a normal hand scanner may be the better choice for some people.

ok will do