处理2D扫描仪读取事件 [英] Handle 2D Scanner read event

查看:61
本文介绍了处理2D扫描仪读取事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一台USB 2D扫描仪,我想阅读PDF417条形码。

它返回一个Asscii代码,所以当我用记事本阅读时许多窗口开始打开。

我尝试使用与常规条码扫描器相同的代码和文本框并处理KeyDown事件但是也没有工作。

任何人都可以帮助如何阅读这个Ascii代码???

Hi All,
I have a USB 2D scanner, and I want to read PDF417 barcode.
It returns an Asscii code so when I read it using a notepad many windows start to open.
I tried to use the same code as the regular barcode scanner with a Textbox and handled the KeyDown event but did not work too.
Can anyone help how to read this Ascii code???

private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var result = textBox1.Text;
                MessageBox.Show(result.ToString());
            }

        }

但这不起作用。

推荐答案

你应该在keypress上做事件代替并取消键输出到文本框



You should do it at keypress event instead and cancel the key output to the textbox

private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
	Console.WriteLine(e.KeyChar.ToString()); //You can do other process here
	e.Handled = true;
}


这篇关于处理2D扫描仪读取事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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