troubleshooting Question

Wha textbox event to use when reading a swipe card in VB.net 2005

Avatar of nomar2
nomar2 asked on
Visual Basic.NET
5 Comments1 Solution525 ViewsLast Modified:
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
            End If
      Else
         Msgbox " Wrong Card"
        End If

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.



ASKER CERTIFIED SOLUTION
Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros