Hi
I try to connect to a cardreader from a VB.NET 2003 application. The
cardreader manufacturer has provided an OCX to access the reader
trough. The OCX sends status messages back by using callback
functions. It requires me to provide a sub named
'ip_flxPrintSta tus(ByVal cStat1 As String, ByVal cStat2 As String)' to
handle status messages returned from the reader.
I have no problem making it work in VB6, but in VB.NET I can not catch
the callback messages.
VB.NET Code:
_______________ _______________ _____________
Public Class Form1
Inherits System.Windows. Forms.Form
Private currentSocket As Integer
'Open connection to terminal
Private Sub btnOpen_Click(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnOpen.Click
Dim i As Integer = ip.flxOpen("192 .168.1.15", "2000")
If i 1 Then
Me.currentSocke t = i
Else
MsgBox("Connect ion error! Code: " & i)
End If
End Sub
'Close connection to terminal
Private Sub btnClose_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnClose.Click
Me.ip.flxClose( Me.currentSocke t)
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStat us(ByVal cStat1 As String, ByVal cStat2
As String)
MsgBox("cb_prin tstatus")
MsgBox(cStat1)
MsgBox(cStat2)
Application.DoE vents()
End Sub
'Start purchase of a value of NOK 1.00, this will trigger a status
message to be sent back from terminal...
Private Sub btn100_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btn100.Click
Dim i As Integer = ip.flxNorCardTr ansaction(1, 150, 578, 0, 0,
150, "first", "second")
MsgBox("Transac tion result: " & i)
Thread.CurrentT hread.Sleep(300 0)
End Sub
End Class
_______________ _______________ _____________
The following VB6 code works:
_______________ _______________ _____________
Public socket As Long
'Start purchase of a value of NOK 1.00, this will trigger a status
message to be sent back from terminal...
Private Sub btn100_Click()
i = ip.flxNorCardTr ansaction(1, 150, 578, 0, 0, 150, "", "")
End Sub
'Close connection to terminal
Private Sub btnClose_Click( )
ip.flxClose (socket)
End Sub
'Open connection to terminal
Private Sub btnOpen_Click()
i = ip.flxOpen("192 .168.1.15", "2000")
If i 1 Then
socket = i
Else
MsgBox ("Connection error!. Code: " & i)
End If
ok = DoEvents()
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStat us(ByVal cStat1 As String, ByVal cStat2 As
String)
MsgBox ("cb_printstatu s")
MsgBox (cStat1)
MsgBox (cStat2)
ok = DoEvents()
End Sub
_______________ _______________ _____________
In VB6 i open the connection, push the 100,- button and the
ip_flxPrintStat us sub immediately pops up a message box with the
status returned from the terminal.
In VB.NET the ip_flxPrintStat us never get executed. If anyone has any
suggestions why, I would be a happy man :-)
__
Tor Inge
Norway
I try to connect to a cardreader from a VB.NET 2003 application. The
cardreader manufacturer has provided an OCX to access the reader
trough. The OCX sends status messages back by using callback
functions. It requires me to provide a sub named
'ip_flxPrintSta tus(ByVal cStat1 As String, ByVal cStat2 As String)' to
handle status messages returned from the reader.
I have no problem making it work in VB6, but in VB.NET I can not catch
the callback messages.
VB.NET Code:
_______________ _______________ _____________
Public Class Form1
Inherits System.Windows. Forms.Form
Private currentSocket As Integer
'Open connection to terminal
Private Sub btnOpen_Click(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnOpen.Click
Dim i As Integer = ip.flxOpen("192 .168.1.15", "2000")
If i 1 Then
Me.currentSocke t = i
Else
MsgBox("Connect ion error! Code: " & i)
End If
End Sub
'Close connection to terminal
Private Sub btnClose_Click( ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnClose.Click
Me.ip.flxClose( Me.currentSocke t)
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStat us(ByVal cStat1 As String, ByVal cStat2
As String)
MsgBox("cb_prin tstatus")
MsgBox(cStat1)
MsgBox(cStat2)
Application.DoE vents()
End Sub
'Start purchase of a value of NOK 1.00, this will trigger a status
message to be sent back from terminal...
Private Sub btn100_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles btn100.Click
Dim i As Integer = ip.flxNorCardTr ansaction(1, 150, 578, 0, 0,
150, "first", "second")
MsgBox("Transac tion result: " & i)
Thread.CurrentT hread.Sleep(300 0)
End Sub
End Class
_______________ _______________ _____________
The following VB6 code works:
_______________ _______________ _____________
Public socket As Long
'Start purchase of a value of NOK 1.00, this will trigger a status
message to be sent back from terminal...
Private Sub btn100_Click()
i = ip.flxNorCardTr ansaction(1, 150, 578, 0, 0, 150, "", "")
End Sub
'Close connection to terminal
Private Sub btnClose_Click( )
ip.flxClose (socket)
End Sub
'Open connection to terminal
Private Sub btnOpen_Click()
i = ip.flxOpen("192 .168.1.15", "2000")
If i 1 Then
socket = i
Else
MsgBox ("Connection error!. Code: " & i)
End If
ok = DoEvents()
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStat us(ByVal cStat1 As String, ByVal cStat2 As
String)
MsgBox ("cb_printstatu s")
MsgBox (cStat1)
MsgBox (cStat2)
ok = DoEvents()
End Sub
_______________ _______________ _____________
In VB6 i open the connection, push the 100,- button and the
ip_flxPrintStat us sub immediately pops up a message box with the
status returned from the terminal.
In VB.NET the ip_flxPrintStat us never get executed. If anyone has any
suggestions why, I would be a happy man :-)
__
Tor Inge
Norway
Comment