文本框条形码阅读器问题 [英] textbox barcode reader problem

查看:66
本文介绍了文本框条形码阅读器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i有阅读条形码的任务并插入数据库。



exp:

条形码:abc



我的问题是我在条形码上扫描到文本框。

我得到的价值是'a',然后是'ab',然后是'abc'



我可以获得条形码的任何想法值'abc',然后触发动作。

*我的条形码是动态长度的。

Hi all,

i have a task on read bar code and insert to database.

exp:
barcode : abc

my problem is when i scan on the barcode to textbox.
the value i get is 'a', then 'ab', then 'abc'

any ideas that i can get the barcode value 'abc', then fire the action.
*my barcode is in dynamic length.

推荐答案

我用过的条码扫描器过去在文本的末尾放了一个回车+换行符(即\\\\ n),所以我使用KeyDown事件并检查Enter键以等待提交完整的条形码:



Barcode scanners I have used in the past put a carriage return + newline (i.e. "\r\n") at the end of the text so I use the KeyDown event and check for the Enter key to wait for the full barcode to be submitted:

private void tbEnterSerialNum_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.Enter)
    {
        string serialnumber = this.tbEnterSerialNum.Text;

        // now do enter it into the database...
    }
}


这篇关于文本框条形码阅读器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆