public partial class Form1 : Form { DateTime _lastKeystroke = new DateTime(0); List<char> _barcode = new List<char>(10); public Form1() { InitializeComponent(); } private void Form1_KeyPress(object sender, KeyPressEventArgs e) { TimeSpan elapsed = (DateTime.Now - _lastKeystroke); if (elapsed.TotalMilliseconds > 100) _barcode.Clear(); // record keystroke & timestamp _barcode.Add(e.KeyChar); _lastKeystroke = DateTime.Now; // process barcode if (e.KeyChar == 13 && _barcode.Count > 0) { string msg = new String(_barcode.ToArray()); label1.Text = msg; //queryData(msg); _barcode.Clear(); } } } }
how to remove focus on button when reading data from scanner barcode
textBox1.Focus();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)