Vb.net Barcode Scanner

0 views
Skip to first unread message

Marguerite Gilbeau

unread,
Aug 3, 2024, 4:17:22 PM8/3/24
to globefilup

My program is already working fine, I use a TextBox to capture the barcode scanner input. The purpose of my program is for time and attendance monitoring, the problem is I want to prevent users from using the keyboard to type in their ID's as it would render the barcode scanner and their ID's with barcodes useless.

Get a barcode-scanner that is connected to a serial-port (raw serial device read by a COM port). As most barcode-scanners emulate keyboard strokes there is no way to directly distinguish a barcode scanner input from a keyboard input (see next option) without going low-level (see last update).

Count number of chars typed by time. Barcode-scanners inject a sequence (line) pretty fast compared to typing. Measuring the time used in the textbox by counting key-presses (use CR+LF as a measure point as these are sent by the scanner as well) can give you one method to distinguish if a human is typing (unless there is one typing fast as f) or the content was injected. If timed-out just reject/clear the input.

Combine option 2 but instead of measure in the textbox tap into the ProcessCmdKey() function (by overriding it) and measure there if textbox has focus. This way you can first buffer input, measure time and if within a set time-out value, inject the line into the textbox.

Usability improvements: make it visually very clear that bar-codes must be entered with a scanner and not typed. I am including as an option as it is simple and if made correct also effective (there's no right answer of what is correct unfortunately).

Approached could include f.ex. a watermark in the textbox ("Don't type, scan!" or something in that order). Give it a different color, border, size etc. to distinguish it from normal textboxes, and have a help text associated and available at all time that improves clarity.

If the textbox initially had a length of 0 chars and now has a length of 17 chars it means that the text was scanned. If the length of the previously typed text is less than 17 chars, then the text was typed.It is very basic but it works for me.

Barcode scanners can often be configured to append carriage return and line feed to the end of the scan. I have a form that can take user input or barcode scanner input into a bound combobox using the _PreviewKeyDown property and trapping on the value "Keys.Enter".

Verifying the data exists in the datasource is a bit trickier because the SelectedValue property of the combobox doesn't update so that event doesn't fire. I used a custom method to verify that the value scanned exists in the datasource. This method uses the .Text property of the combo box. It uses:

All of my scanner input goes into a "hidden" textbox, which then fills the visible ones as needed depending on the input. This, of course, means you need to keep track of where the focus is. Any type of control that can get focus will then make a call in those events to return focus to whatever the "active" textbox is at that time, which is normally the hidden one. For example...

Most of the scanners has a driver to communicate with (Opos) it has functions to open the scanner port and listen to the scanning , so you take the result and decode it in the background and then display the result in the Textbox... what you need to do it to check your barcode scanner's brand go to it's website and download the driver and its manual.

I have a multiline text box which is used to enter barcode numbers into. I have a barcode scanner and all the barcodes will end in L2, L3 or L4. Once a barcode is scanned in I need VB to detect either L2, L3 or L4 then go to a new line and repeat.

What happens is when I scan (or type) a barcode in the text box the cursor jumps to the begining of the line. If you press the down arror key the cursor does move to the new line but it won't do it automatically for some reason.

Ive got 4 different barcode scanners here, the old wand type looks like a pen and is a wedge type it hooks from keyboard-pen-pc, i also have a usb gun style no wedge needed, and a few others , they all work without needing drivers or software to configure them, its kinda like those little number pads that you could plug to your pc if your keyboard was a short style that had no number pad, whatever the barcode scanner reads is just the raw integer and is sent to the pc with a carridge return at the end, so all you have to do is select a textbox (make sure the cursor is blinking in it) and scan your item, it will populate the textbox with the number. if your smart you can set your textbox to do something when text changes, thats so it appears automated :)

The only problem alot of people have is directly related to the scanner itself, most scanners/wands only read certain types of barcodes. my wands will only read UPC codes on products (I think its type 39) but cant read those with letters , its also hard to scan sometimes. you can get a very nice Symbol gun style clone USB on ebay for about $15 - 25, there wonderfull and they read just about every kid of barcode that is line based. LINK . I wouldnt go with a wand style or the brush style (looks kinda like a paint brush) I would only go with the gun style unless you have to be hands free then the brush style is better, but most of them other than wands have a button that has to be pushed to turn the laser on.

You Know Your Addicted To Computers When - Your main computer is a 7 terabyte, Core2Quad 3 Ghz +, with 4 or more gigs ram, over 200 programs installed, and you would rather sit with it programming than go to the movies!

Oh No, I've got 13 PC's in the House and 7 are in my bedroom and my main one exceeds this set of stats. Does anyone know a good psychologist?

Up to and including "you can't do it that way". It's shocking how many so-called web developers from the Windows side don't realize that in browsers on those other platforms you can't necessarily have arbitrary access to the file system and attached devices--and that this is considered a feature.

I won't do the work the original poster is asking us to do, but there is actually a way to use barcode scanners without having access to attached devices or the filesystem (and it will work on any browser for that matter).

Most barcode scanners support emulating keyboard presses (and send them as if someone would actually type out the number the barcode represents). Some of them even allow you to set a leading character (just some control code) and to end the barcode with some keypress (like ENTER or Return or even a custom random keystroke). You'll have to do your own research to find which ones you can buy where you live and which ones support this feature. On a side node, most local barcode scanner suppliers will be happy to send you a test device if you ask them nicely.

Given that the barcode scanner allows for a leading and a trailing keypress, all that would be required is that the browser window that allows scanning the barcode is the frontmost and active window at all times. Then it's just a matter of writing some javascript code that listens for the keyup event, if the leading control code is sent you start capturing whatever comes next into a javascript variable until it hits the trailing control code, then send that off to the server for processing.If the barcode scanner doesn't allow a leading character, you can just make sure that webpage is just accepting barcode input.

This is as far as I can and will take you. You basically have all the pieces of the puzzle, now it's up to you to find the right device, write the necessary code to capture the device output and make it work with your app. That's part of being a developer: solve problems and come up with a good solution and then actually write the code for it.

there are many ways to do that. If you wanna save these complicatedsteps and find a easy way, you can google barcode scanner and you willfind many useful tools, or google how to read barcode in c# to getinstructive articles. Good luck:) I think some imaging sdk programmescan enable to quickly scan barcodes. i have use imaging sdkr which canoriginal layouts hyperlinks, Images and tables retained in word ,text,image, Epub, html.but i forgot download the wedsite ,go to google. Bythe way , pay attention to your system platform, select the suitable one. I use a barcode scanner driver found on the internet . Install it andit becomes a selectable option.Then you can scan barcodes in manyformats in any program at all, including Adobe Acrobat . Just open thesdk, select barcode, and choice a form you want, then you can scanbarcode in c#, vb, sdp ,etc ,the task will be finished in severalseconds. if you haven't found a good choice , you can have a try. bestwishes.

Integrating a barcode reader within a asp.net imaging application is nomore a problem. Such image barcode reading toolkit of web asp.netproject can be used to detect and decode any linear or 2d barcode fromimage or document page.

BC.NetBarcodeReader.All is a comprehensive barcode scanner library for your .NET applications development. This .NET barcode scanner library can be used in C# and VB programming projects. It supports the most popular barcode symbologies, like reading 2d barcodes QR Code, Data Matrix, and reading 1d barcodes Code 128 and EAN/UPC. You can easily add this .NET barcode reader solution into your VS projects, by simply adding your project reference to the library dll, BC.NetBarcodeReaderTrial.All.dll. After integration, you can easily:1.Scan and read barcode(s) from images (.jpg, .jpeg, .tif, .tiff, .png, .bmp, .gif)2. Scan and read barcode(s) from a multi-page Tiff image file

If you have any questions about BarcodeBC .NET Barcode SDKs, technical, sales, pre-sales, reseller, or annual maintenance, please send email to us. Reply Within 24 Hours! Support Email: con...@barcodebc.com.

Is there a USB barcode scanner/software that has an SDK/API that doesn't just use a keyboard emulator to input the data it scans? Like, when someone scans a barcode, have it process that information in the background without the need to have a program focused on a textbox or something.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages