Barcode scanning

Posted on 2014-08-17
Medium Priority
Last Modified: 2014-10-25
Hi All,

I am working on a c# winforms application, which should read the barcode value when scanned from barcode sanner pick the required information from database and display that on the screen.

Till now i have worked on such applications, where i will have a cursor on some textbox control, when the user scans the barcode, it will be printed on the textbox. Based on the value on the textbox I use to write a query to get the value from database. But with the new application, it is told that there will be no control on the screen, It is told that if the user keeps the screen active and scans the barcode, the application should read the scanned value and get data from database and print that on the screen.

Can anyone please help me in getting the barcode value without having the control on the screen.

Thanks in advance,
Question by:rajeeva_nagaraj

Expert Comment

by:Sathish DV
ID: 40267064
Hi Rajeev,

As per my understanding, in your previous projects you use to scan the barcode and set it values directly to textbox say for eg. txtBarcode be your text box name. So you have set the value of barcode directly to text box like txtBarCode.Text = <scanned value from scanner>, then u might read the data from text box as string someVal = txtBarcode.Text and pass the someVal to database to query the database.
Instead set the string variable directy from scanned value like string someVal = <scanned value from scanner>, then you can use the same the existing code to fetch the data from database.
Check if this helps you. If not is it possible to post some sample code on you set data to  textbox?


Author Comment

ID: 40267335
Thanks for the reply Sathish,

I am looking at the C# code which can catch the value in to a variable. If you could get me the sample code, that will be nice for me.

LVL 14

Accepted Solution

frankhelk earned 2000 total points
ID: 40267620
I don't have my VS at hand, but I'll try a quick outline ...

The usual scanners for your "old" application worked probably by slicing the device into the keyboard cable (not literally, but with some kind of Y cable). When the user scans, the input is fed into the keyboard queue and processed similar.

The async usage works on another way ... the scanner in that case sends its data automatically via some more "industrial" interface, like as serial interface (RS232, V.24, RS485, a industrial field bus interface like CAN bus or I2C etc, or possibly socket acces on Ethernet ... there are much possiblities).

Your program would have to connect that interface and implement to get events if data arrives, and it would have to sort out complete and valid datasets for processing. The data may arrive in various formats, depending on your preferred device. The most easy way would be ASCII, like [STX]<ascii data>[ETX], but there are various flavours of that around. Depending on the code to read and the used scanner, the data may be in some kind of binary format, could contain check sum parts, and other nasty strings attached. After receiving a complete dataset, your code needs to take the needed measures like servicing any other event (i.e. as having got a button pess)

I've done such software myself (with an easy config: RS232 interface, plain ASCII data), but the implementation depends much on your detailled config.

Can you elaborate a bit more on your configuration ?

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question