textbox_TextChanged event
I am currently using the TextChanged event of a textbox which fires after a user scans a barcode into it.
The problem is that if the user scans 10 characters into it it fires 10 times.
There are times when I want after lets say 4 characters to clear the entry to present the user with a blank textbox. If after the the 4th fireing of the event I use textbox.text = "" it will only remove the first 4 characters and leave the remaining 6.
Any Ideas ?
Man am I stressed today :-(
Re: textbox_TextChanged event
a little confused... but you are saying each time they scan a barcode, it is only 1 character going into the textbox?
Re: textbox_TextChanged event
If I scan in a 10 character barcode the textchanged event fires ten times.
"1"
"12"
"123"
"1234"
.
.
"1234567890"
Re: textbox_TextChanged event
And you want to clear the textbox in the fourth fire? Do you mean the barcode is populating the textbox incrementally? As in, no matter what you delete in the 9th fire, the 10th time, the textbox will have 10 characters?
Then perhaps you should be doing a check for the length of the text itself, or even better find another event such as validate to use.
Re: textbox_TextChanged event
yeah i was just about to say you probably don't want to use the textchange event... its more for validating char by char what is being put in, where I would think when scanning a barcode, you just want to look at things when the scan has been completed.
Re: textbox_TextChanged event
Thanks for that.
I'll look into the validate event.