Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I am building a inventory system in which I require a barcode interface. In my program I am thinking to keep a textbox in which the cursor is focused and when the barcode is scanned the corresponding data of the code in the database should be displayed in the database in the same form.

How can I manage the event handling of barcode entry? I am using Visual Studio 2008.

Can anyone please help me?

Thank you.

Updated 12-Oct-11 6:04am
Albert Holguin 12-Oct-11 11:11am    
This question may be a bit too vague... expect vague answers...
amsainju 12-Oct-11 12:23pm    
ya maybe i am not a pro..just learning so can't properly explain sorry... but i got my answer

1 solution

Do you noticed when we scan a barcode to computer it will print the character string and move the cursor to next line...,
ie,One enter is pressing after printing barcode string in text box, You can check this from keydown event

private void textBox1_KeyDown(object sender, KeyEventArgs e)

           if (e.KeyCode == Keys.Enter)
               //Type your code for getting data from database

Share this answer
amsainju 12-Oct-11 11:53am    
thanks pal....u solved my big problem...thanks alot...
DaveyM69 12-Oct-11 18:43pm    
Most barcode scanners I have come across can be programmed to use a different or no suffix. All the ones in my company for example are programmed to send TAB after the scanned code.
Arun Kumar K S 15-Oct-11 2:00am    
Use TextBox2.Focus() method
amsainju 14-Oct-11 5:51am    
how can we program the barcode for different key?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900