2
Answers

How to increase number of characters when reading data from

ahmed salah

ahmed salah

7y
186
1

I work in windows from c# vs 2015

i read data from scanner bar code reader directly to my windows

without using text box box but i face problem

i need to increase number of character when receiving to 200 character

so that how to increase that please ?

code below working success but it read only 13 character

i need to increase it to 200 character or less so that how ?
  1. public partial class Form1 : Form  
  2.     {  
  3.         DateTime _lastKeystroke = new DateTime(0);  
  4.         List<char> _barcode = new List<char>(10);  
  5.         public Form1()  
  6.         {  
  7.             InitializeComponent();  
  8.         }  
  9.   
  10.          
  11.   
  12.         private void Form1_KeyPress(object sender, KeyPressEventArgs e)  
  13.         {  
  14.             TimeSpan elapsed = (DateTime.Now - _lastKeystroke);  
  15.             if (elapsed.TotalMilliseconds > 100)  
  16.                 _barcode.Clear();  
  17.   
  18.             _barcode.Add(e.KeyChar);  
  19.             _lastKeystroke = DateTime.Now;  
  20.   
  21.             if (e.KeyChar == 13 && _barcode.Count > 0)  
  22.             {  
  23.                 string msg = new String(_barcode.ToArray());  
  24.                  
  25.                 label1.Text = msg;  
  26.                 _barcode.Clear();  
  27.             }  
  28.         }  
  29.     }  
  30. }  
 

so that code above can read but 13 character only

i need to increase it to 200 character or less .

bar code scanner is working as USB keyboard as HID keyboard read qr code

Answers (2)