如何清除扫描仪从文本框中读取的数据以接收另一个? [英] How to clear data readed by scanner from textbox to recieve another one?
问题描述
问题
当使用条形码扫描器读取多个时,它会附加相同的文本框4.
i需要在每次扫描完成后清除数据。
详细信息
我使用usb扫描仪阅读器qr代码,类型为地铁逻辑,用作键盘
并使用USB
i读取textbox4中的数据键成功
但如果我读取新qr代码的数据有问题
它附加在同一文本框中
这样我所做的就是清除之前收到的数据并防止附加到旧的
我的代码
private void textBox4_KeyDown( object sender,KeyEventArgs e)
{
string [] lines = textBox4.Text.Split( new string [] {Environment.NewLine},StringSplitOptions.None);
if (lines.Length > 4 )
{
textBox1.Text = lines [ 1 ]。子串(行[ 1 ] .IndexOf( :)+ 1 跨度>);
textBox2.Text = lines [ 2 ]。子串(行[ 2 ]。IndexOf( :)+ 1 );
textBox3.Text = lines [ 3 ]。子串(行[ 3 ]。IndexOf( :)+ 1 );
textBox5.Text = lines [ 4 ]。子串(行[ 4 ]。IndexOf( :)+ 1 );
}
textbox4从读卡器设备读取数据然后将它们拆分为文本框
我尝试了什么:
如何清除扫描仪从文本框中取出的数据以接收另一个?
通常,有两种方法可以清除文本框 - 使用你的情况
textBox4.Clear();
或
textBox4.Text = string .Empty;
这个问题是我不确定你的逻辑/程序流程,从而'在哪里'在你的代码中这样做
我想你在此之前做的/新的阅读引用:但是如果我读新数据代码的数据
就会出现问题,但是你已经显示了很多'代码'所以我不知道你的程序在哪里[/ edit]
Problem
When read qr using barcode scanner for more than one it append the same textbox4 .
i need to clear data after every scanning done .
Details
I using usb scanner reader qr code with type metro logic working as keyboard
and using USB
i read data in textbox4 key down success
but problem if i read data for new qr code
it append in same text box
so that what i do to clear the data recieved before and prevent append to old
my code
private void textBox4_KeyDown(object sender, KeyEventArgs e)
{
string[] lines = textBox4.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
if (lines.Length > 4)
{
textBox1.Text = lines[1].Substring(lines[1].IndexOf(":") + 1);
textBox2.Text = lines[2].Substring(lines[2].IndexOf(":") + 1);
textBox3.Text = lines[3].Substring(lines[3].IndexOf(":") + 1);
textBox5.Text = lines[4].Substring(lines[4].IndexOf(":") + 1);
}
textbox4 read data from reader device then split them to textboxes
What I have tried:
How to clear data readed by scanner from textbox to recieve another one?
In general, there are two ways to clear a textbox - using your case
textBox4.Clear();
or
textBox4.Text = string.Empty;
this issue is I'm not sure of your logic/program flow, and thence 'where' to do this in your code
[edit] I guess you do it before this/the new read "Quote:but problem if i read data for new qr code
happens, but you havnt shown much 'code' so I dont know where that is in your program [/edit]
这篇关于如何清除扫描仪从文本框中读取的数据以接收另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!