如何在使用条形码阅读器从用户获取新值时清除文本框 [英] How to clear a textbox while getting new value from user using barcode reader

查看:79
本文介绍了如何在使用条形码阅读器从用户获取新值时清除文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Windows窗体应用程序,在表单加载我的重点是在文本框中我必须从条形码阅读器获取输入,我的应用程序工作正常,但有一个问题,在获得输入我的应用程序显示反对id的数据,但是当我从条形码阅读器获得另一个输入时,它不会删除文本框中的先前值并混合两个值,我不能在获取数据后调用textbox.clear函数,因为我需要文本框中的数据直到next录制输入。

解决方案

您需要在使用它时将其删除,或与条形码扫描仪制造商交谈 - 大多数扫描仪都可以配置为提供特殊扫描开始和/或结束代码,以便您可以发现新代码何时到达,或旧代码何时完成。具体如何配置它因制造商而异(有时从型号到型号!)


您可以尝试此代码。

 TextBox tx =  new  TextBox(); 
tx.Text = ;
tx.Text = string .Empty;
tx.Clear();



如果查询点击了回复。


除了常识性建议你是从OriginalGriff获得的,我建议你立即将扫描的输入结果复制到相应类型的私有内存字段或另一个屏幕上的TextBox。



您是否需要存储/保存多个而不是一个扫描结果取决于扫描过程的性质:如果扫描是自动完成的,而不是在操作人员的控制之下......可能在装配线上发生......好吧:这是一个完全不同的场景。



如果需要,您还可以保存扫描历史记录和DateTime,使用Struct或类的实例来表示单次扫描。



如果您提供有关扫描过程性质和角色的更多详细信息(如果任何人类操作员,你可以得到更有针对性的建议。

I am working on a windows form application, on form load my focus is on the text box where i have to get the input from barcode reader, my application is working fine but there is a problem that after getting input my application show the data against the id, but when i get another input from barcode reader it does not remove the previous value in text box and mix both value, i can not call the textbox.clear function after fetching data because i need the data in textbox till next recorde enter.

解决方案

You either need to remove it when you have used it, or talk to the barcode scanner manufacturer - most scanners can be configured to provide a special start and / or end code so you can spot when a new code is arriving, or when the old one is complete. Exactly how you configure it differs from manufacturer to manufacturer (and sometimes model to model!)


you can try this code.

TextBox tx = new TextBox();
            tx.Text = "";
            tx.Text = string.Empty;
            tx.Clear();


if query hit the reply.


In addition to the common-sense suggestions you got from OriginalGriff, I'd like to suggest you immediately copy the incoming result of a scan into either a private memory field of an appropriate Type, or to another on-screen TextBox.

Whether you might need to store/save several, rather than one, scan result would depend on the nature of your scanning process: if the scans are being done automatically, not under the control of a human operator ... as may happen in an assembly line ... well: that's a whole different scenario.

You could also save a history of the scans along with a DateTime if needed, using an instance of a Struct, or Class, to represent a single scan.

If you give more details of the nature of the scanning process, and the role (if any) of the human operator, you can get more focused advice.


这篇关于如何在使用条形码阅读器从用户获取新值时清除文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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