Capture barcode input in Textbox
Hi,
I have a USB scanner that I use to input into a textbox. The issue is that I'll need to check for a barcode that is 6 digits long and another that is 9 digits long. Since the characters come in one at a time the 6 char length condition will always be satisfied. Has anyone had to deal with something like this?
Code Samle:
Code:
private void txtTicketID_TextChanged(object sender, EventArgs e)
{
if (txtTicketID.Text.Length == 9)
{
.....
}
if (txtTicketID.Text.Length == 6)
{
.....
}
Re: Capture barcode input in Textbox
maybe you can do it like this...
Code:
if (txtTicketID.Text.Length > 8 && txtTicketID.Text.Length < 10)
{
.....
}
if (txtTicketID.Text.Length > 5 && txtTicketID.Text.Length < 7)
{
.....
}
Re: Capture barcode input in Textbox
Can't you just read from the scanner until it is done and then update the textbox?
Re: Capture barcode input in Textbox
Even Spock couldn't write the logic for that. ;)
As Ed says, you need to read all of the characters from the Barcode reader before processing it. If the reader can read Barcodes that translate to either 6 or 9 or N digits, there must be a termination character included in its output?