Improve Barcode search in a Textbox C#

前端 未结 5 1039
死守一世寂寞
死守一世寂寞 2021-01-23 21:27

In a WinForm C# application I have a Barcode_textbox. In TextChanged event I have an SQL query to check for the TextBox.Text value in the database which is the barc

5条回答
  •  臣服心动
    2021-01-23 21:59

    Timers are a horrible solution to this.

    Use the KeyUp event of the TextBox and check for a carriage return. Most barcode scanners submit a carriage return after the code.. and if they don't do it by default, they come with barcodes to configure it to do so.

    You can test this by opening Notepad and scanning barcode after barcode into it. Each one will be on a new line.

提交回复
热议问题