For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > July 2006 > reading from a card reader









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author reading from a card reader
Abby

2006-07-03, 6:56 pm

Hi all,

I have an application in which I am trying to read the data stored from a
magnetic card reader. I was using the inputbox function but am able to read
only the 1st Track of data. i also need to read the data in the second track.

Any help would be appreciated.

Thanks in advance.



Michael C

2006-07-03, 6:56 pm

"Abby" <Abby@discussions.microsoft.com> wrote in message
news:000AB258-1D63-46E8-9D5F-7743B01E5E4F@microsoft.com...
> Hi all,
>
> I have an application in which I am trying to read the data stored from a
> magnetic card reader. I was using the inputbox function but am able to
> read
> only the 1st Track of data. i also need to read the data in the second
> track.
>
> Any help would be appreciated.


Textbox

>
> Thanks in advance.
>
>
>



JP Bless

2006-07-03, 9:55 pm

Dim iTracks As Integer
Dim iCounter As Integer
'iTrack value must set to the number of tracks
'input magnetic stripe has
'Also default iCounter to 1
'Also ensure TextBox1 multiline property is set

Private Sub Form_Load()
iCount = 1
iTracks = 2 'Default to 1 track magstripe
End Sub

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_KP
Select Case KeyCode
Case 13 'ENTER key...
'If magnetic card reader is one track..
If iTracks = 1 Then
'Put code here to decode/read input from magnetic reader
DoEvents
Unload Me
Exit Sub
End If
'If card reader is more than 1 track
If iCounter < iTracks Then
'iterate all tracks until all tracks are read
iCounter = iCounter + 1
Exit Sub
Else
'Put code here to decode/read input from magnetic reader
'Be aware that if more than 1 track is read
'Use start and stop sentinals (special separator characters)
'to determine tracks relevant characters
iCounter = 1
DoEvents
End If
End Select
Exit Sub
Err_KP:
Exit Sub
End Sub
















"Abby" <Abby@discussions.microsoft.com> wrote in message
news:000AB258-1D63-46E8-9D5F-7743B01E5E4F@microsoft.com...
> Hi all,
>
> I have an application in which I am trying to read the data stored from a
> magnetic card reader. I was using the inputbox function but am able to

read
> only the 1st Track of data. i also need to read the data in the second

track.
>
> Any help would be appreciated.
>
> Thanks in advance.
>
>
>



Michael C

2006-07-03, 9:55 pm

"JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message
news:OSAor6wnGHA.4352@TK2MSFTNGP02.phx.gbl...

What is the purpose of the DoEvents in code? (except maybe to introduce
subtle hard to find bugs)

Michael


JP Bless

2006-07-03, 9:55 pm

cheers up the pc while waiting for data from magstripe
lol


"Michael C" <nospam@nospam.com> wrote in message
news:e5TDvQxnGHA.4728@TK2MSFTNGP03.phx.gbl...
> "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message
> news:OSAor6wnGHA.4352@TK2MSFTNGP02.phx.gbl...
>
> What is the purpose of the DoEvents in code? (except maybe to introduce
> subtle hard to find bugs)
>
> Michael
>
>



Michael C

2006-07-03, 9:55 pm

"JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message
news:ONvcBkxnGHA.2364@TK2MSFTNGP02.phx.gbl...
> cheers up the pc while waiting for data from magstripe
> lol


But control is about to fall out of the event anyway, in both cases it is
just before the event exits. This could easily cause re-entrancy issues that
would be difficult to debug.

Michael


JP Bless

2006-07-04, 7:55 am

By the way, did you try this code? Have used it for years... never had a
problem... never had re-entrancy problem... and by the way the DoEvents
never kicks in until magstripe signals end of transmission. If you find the
DoEvents too troubling nix it and life goes on.


"Michael C" <nospam@nospam.com> wrote in message
news:ObEzqvxnGHA.4892@TK2MSFTNGP03.phx.gbl...
> "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message
> news:ONvcBkxnGHA.2364@TK2MSFTNGP02.phx.gbl...
>
> But control is about to fall out of the event anyway, in both cases it is
> just before the event exits. This could easily cause re-entrancy issues

that
> would be difficult to debug.
>
> Michael
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com