Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Magnetic card reader with credit card
Message
From
26/09/2012 10:05:48
 
 
To
26/09/2012 09:59:43
Hee Lim Wang
Fantasy Software Enterprise
Malaysia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01553570
Message ID:
01553669
Views:
51
I suggest that you use an editbox instead of a textbox, since an editbox won't jump to the next control when an Enter is entered. Unfortunately I'm too busy to give you more help right now. Anyway, your problem is that the data contains chr(10) and/or chr(13) which moves the focus to the next control.

>here are the output by card reader
>* cREDIT CARD
>
>%B4322041000689130^JOHNNY ENGHIDH ^1205201929960000000000008100000?
>;4322041000689130=12052019299600810000?
>
>Lostfocust coding in 2 text box is
> this.Value=LEFT(ALLTRIM(this.Value),16)
>inputmask = 999999999999999999999999999999999999
>so it will show 4322041000689130 in my 1st text box but 2nd text box also got the same value 4322041000689130
>how to clear the buffer after Lostfocust in the first text box ?
>
>* normal MEMBER CARD is shorter and no problem in my form
>
>;634009480039586848=000086848000000000?
>
>
>
>I haven't studied your code, but it looks like you are on the right track. You can also accept the whole string as is, and then parse it and replace it in the lostfocus event. My guess is that the data comes so quick that nobody will see any flicker. This code will extract the number:
>this.value = Strextract( this.value,'%B','^')
>>Assuming that the format described in the following page is accurate:
>>http://stackoverflow.com/questions/2121881/parse-credit-card-input-from-magnetic-stripe
>>
>>... and we assume the first set of digits following the "%B" is the number we want...
>>
>>Perhaps we could "brute-force" it by using Keypressed event and state machine?
>>
>>Let's say we've got text box (with no input mask) with the following:
>>
>>Code the INIT:
>>
>THIS.ADDPROPERTY("nState",0)
>>
>>Code in GotFocus event:
>>
>THIS.nState=0
>>
>>Code in the KeyPress event:
>>
>>LPARAMETERS nKeyCode, nShiftAltCtrl
>>
>>IF m.nKeyCode==13 OR m.nKeyCode==9 THEN && Tab, Enter
>> THIS.nState=0 && Init state
>> RETURN
>>ENDIF
>>IF m.nKeyCode==15 AND m.nShiftAltCtrl==1 THEN && Shift-TAB
>> THIS.nState=0 && Init state
>> RETURN
>>ENDIF
>>IF m.nKeyCode==37 AND m.nShiftAltCtrl==1 THEN && % key - found start
>> THIS.nState=1 && Found "sentinel"
>> NODEFAULT && discard
>> RETURN
>>ENDIF
>>IF THIS.nState==1 THEN && Char following "sentinel" (e.g. "B") is discarded
>> THIS.nState=2 && Start reading digits
>> NODEFAULT && discard
>> RETURN
>>ENDIF
>>IF THIS.nState==2 THEN && Read digits
>> IF BETWEEN(m.nKeyCode,48,57) AND m.nShiftAltCtrl==0 THEN
>> * Read Digits
>> RETURN
>> ENDIF
>> * Start discarding input at first non-digit
>> THIS.nState=3 && Discard everything afterwards
>> NODEFAULT && discard
>>ENDIF
>>NODEFAULT && discard
>>
>>
>>In addition, we could set KeyPreview to .T. on the form, then use KeyPress event code at form level to force focus to the text box we've set up when we see "%".
>>
>>>I see that 54128412 and so forth comes twice. Looks like you will have to read everything into a long string, and parse it, before showing the parsed result.
>>>
>>>>in notepad also beep twice
>>>>the text is very long
>>>>%B5412841240001042; WANG HEE LIM ^ 100045400152542;...5412841240001042. and some more....
>>>>my text box inputmask = 999999999999999999999999999999999999 to filter number only
>>>>
>>>>
>>>>Does the card reader output the same number twice? Open Notepad and see what you see.
>>>>
>>>>>Hi all
>>>>>in my POS payment form i got 2 text box for 2 credit card number
>>>>>but when i swept credit card with magnetic card reader in the first text box it beeps twice
>>>>>and both text box have the same credit card number
>>>>>how to swept the card number and just enter number in the first text box and leave the second text box blank ?
>>>>>thanks....
Previous
Reply
Map
View

Click here to load this message in the networking platform