ahmed salah

ahmed salah

  • NA
  • 530
  • 141k

How to clear data readed by scanner from textbox to recieve

Feb 20 2017 6:48 PM

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

  1. private void textBox4_KeyDown(object sender, KeyEventArgs e)  
  2.        {  
  3.             
  4.                string[] lines = textBox4.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);  
  5.   
  6.            if (lines.Length > 4)  
  7.            {  
  8.                textBox1.Text = lines[1].Substring(lines[1].IndexOf(":") + 1);  
  9.                textBox2.Text = lines[2].Substring(lines[2].IndexOf(":") + 1);  
  10.                textBox3.Text = lines[3].Substring(lines[3].IndexOf(":") + 1);  
  11.                textBox5.Text = lines[4].Substring(lines[4].IndexOf(":") + 1);  
  12.            }  
 
 

textbox4 read data from reader device then split them to textboxes


Answers (2)