Wha textbox event to use when reading a swipe card in VB.net 2005
Posted on 2007-07-30
I am using VB.net. I have a textbox on a form that is populated by a person swiping a card. A card is swiped and the info from the magnetic strip on the card is displayed in the textbox.
The card we are using is of a certain format, for example the length of the string is 29 characters and the 10th character is aways a '#', what I need is if someone tries to use a different card ( which will have a differnet format) ....I want to display a msgbox that says "Wrong Card"
I have this on the textChanged event of the textbox...
If Len(txtCustomerID.Text) = 29 Then
If Mid(txtCustomerID.Text, 10, 1) = "X" Then
lnCustomerNumber = Mid(txtCustomerID.Text, 4, 3)
DisplayCustomerCount() ' function that does something
Msgbox " Wrong Card"
The problem is how do I read the textbox only after all the charatcers have been entered in the textbox because with the above code the message box gets fired on every character that is read until it reaches a length of 29.
Any help or insight would be much appreciated.