Example, Sample code – MagTek MTKBDWEDGE.OCX User Manual

Page 21

Advertising
background image

17

EXAMPLE

SAMPLE CODE
Private Sub Form_Load()

‘open the Port

KbdWedge1.PortOpen = True
End Sub

Private Sub Form_Unload(Cancel As Integer)

‘close the Port

KbdWedge1.PortOpen = False
End Sub

Sub KbdWedge_CardDataChanged()

‘assigns the First Name into txtFirst

txtFIRST.Text=KbdWedge1.GetFName()

‘assigns the Last Name into txtLast

txtLAST.Text=KbdWedge1.GetLName()

‘assigns the string between the “;” and the “=” into txtPAN

txtPAN.Text=KbdWedge1.FindElement(2, ";", 0, "=")

‘assigns the string from Track 2.

‘Referencing the “=”

‘Displacing 2

‘Specifying a length of 2

‘into the txtMonth

txtMONTH.Text=KbdWedge1.FindElement(2, "=", 2, 2)

‘assigns the string from Track 2.

‘Referencing the “=”

‘Displacing 0

‘Specifying a length of 2

‘into the txtYear

txtYEAR.Text=KbdWedge1.FindElement(2, "=", 0, 2)

‘assigns the string from Track 1 into the txtTrack1

txtTrack1.Text=KbdWedge1.GetTrack(1)

‘assigns the string from Track 2 into the txtTrack2

txtTrack2.Text=KbdWedge1.GetTrack(2)

‘assigns the string from Track 3 into the txtTrack3

txtTrack3.Text=KbdWedge1.GetTrack(3)

‘Clears the .CardData Property

KbdWedge1.ClearBuffer()
end sub

Advertising