Click here to Skip to main content
13,297,266 members (56,949 online)
Click here to Skip to main content
Add your own
alternative version


188 bookmarked
Posted 23 Jun 2004

VBScan barcode software

, 23 Jun 2004
Rate this:
Please Sign up or sign in to vote.
A barcode scanning and decoding software without third-party software


VBScan is a simple program to scan, decode and draw a barcode. It uses only .NET Framework and Windows API functions, no third party products.

It is designed to work with a "barcode wand" scanner that is connected to the com port (RS232) of a PC. Since most barcode wands have TTL voltages you'll need a converter chip to connect the wand to the PC.

After pressing the start button the program periodically checks the DSR line of the RS232. If a transition between black and white is detected it stores how many ticks the last bar was wide. After scanning and pressing stop the scanned barcode get "cleaned", so that we have no incorrect bars. If you now press decode the barcode will be decoded (only Code 3 of 9 supported at the moment) and the datastring is shown in a textbox.


I wrote this program as a project in school. It was designed to work, and nothing more. I'm not a programming professional, so the code is sometimes a bit ugly.

Using the code

I have written 3 classes: Barcode, Code39 and HighSpeedTimer

The Barcode class stores the scanned data in a simple integer array. The class also provides some functions to clean and draw the barcode.

The Code39 class provides functions to decode an barcode object. It only supports "Code 3 of 9" barcodes, but it wouldn't be a problem to implement other encoding variants too.

The HighSpeedTimer class is a wrapper around the windows API functions to time more exact than the normal timer. I had to do this because the resolution of the standard timer is not high enough to scan barcodes exactly. This is probably the most ugly part in my program. If you start the timer, it uses a high amount of processor power, despite the fact that it does actually nothing... If you can help me improve this class i would appreciate it.

In the download file you'll find all the classes mentioned above and a small program (see the screenshot) to test them.

Note: In the frmMain there is a Paint event of the picturebox to redraw the barcode. It works, but uses much CPU time...


  • 04-06-23: v0.9.1635 - first posted version


This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


About the Author

Austria Austria
No Biography provided

You may also be interested in...


Comments and Discussions

Generali need to generate barcode in windows application Pin
sangeeta singh16-May-05 2:31
membersangeeta singh16-May-05 2:31 
Generalsome one know change port to ps/2 or usb Pin
malilla_man11-Apr-05 13:15
membermalilla_man11-Apr-05 13:15 
GeneralRe: some one know change port to ps/2 or usb Pin
SumathyKC20-Sep-06 4:32
memberSumathyKC20-Sep-06 4:32 
QuestionRe: some one know change port to ps/2 or usb Pin
ericming21-Aug-07 2:56
memberericming21-Aug-07 2:56 
Questionproblem reading barcodes ? Pin
M.ARAFA16-Nov-04 0:51
memberM.ARAFA16-Nov-04 0:51 
QuestionCode39 Quetsion ? Pin
M.ARAFA11-Nov-04 15:10
memberM.ARAFA11-Nov-04 15:10 
QuestionA Question on using Demo ? Pin
M.ARAFA10-Nov-04 15:22
memberM.ARAFA10-Nov-04 15:22 
Generaltransformed to Pin
tommy skaue29-Jun-04 3:07
membertommy skaue29-Jun-04 3:07 
GeneralRe: transformed to Pin
Socolongo29-Jun-04 3:56
memberSocolongo29-Jun-04 3:56 
GeneralRe: transformed to Pin
Graeme Howell30-Jun-04 16:30
memberGraeme Howell30-Jun-04 16:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 24 Jun 2004
Article Copyright 2004 by demm
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid