-
December 8th, 2009, 05:30 PM
#1
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)
{
.....
}
-
December 8th, 2009, 06:19 PM
#2
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)
{
.....
}
-
December 8th, 2009, 06:42 PM
#3
Re: Capture barcode input in Textbox
Can't you just read from the scanner until it is done and then update the textbox?
-
December 8th, 2009, 11:56 PM
#4
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?
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|