T
toringe
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_flxPrintStatus(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(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnOpen.Click
Dim i As Integer = ip.flxOpen("192.168.1.15", "2000")
If i > 1 Then
Me.currentSocket = i
Else
MsgBox("Connection error! Code: " & i)
End If
End Sub
'Close connection to terminal
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnClose.Click
Me.ip.flxClose(Me.currentSocket)
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStatus(ByVal cStat1 As String, ByVal cStat2
As String)
MsgBox("cb_printstatus")
MsgBox(cStat1)
MsgBox(cStat2)
Application.DoEvents()
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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn100.Click
Dim i As Integer = ip.flxNorCardTransaction(1, 150, 578, 0, 0,
150, "first", "second")
MsgBox("Transaction result: " & i)
Thread.CurrentThread.Sleep(3000)
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.flxNorCardTransaction(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_flxPrintStatus(ByVal cStat1 As String, ByVal cStat2 As
String)
MsgBox ("cb_printstatus")
MsgBox (cStat1)
MsgBox (cStat2)
ok = DoEvents()
End Sub
___________________________________________
In VB6 i open the connection, push the 100,- button and the
ip_flxPrintStatus sub immediately pops up a message box with the
status returned from the terminal.
In VB.NET the ip_flxPrintStatus 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_flxPrintStatus(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(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnOpen.Click
Dim i As Integer = ip.flxOpen("192.168.1.15", "2000")
If i > 1 Then
Me.currentSocket = i
Else
MsgBox("Connection error! Code: " & i)
End If
End Sub
'Close connection to terminal
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnClose.Click
Me.ip.flxClose(Me.currentSocket)
End Sub
'Handle status message callback from terminal
Private Sub ip_flxPrintStatus(ByVal cStat1 As String, ByVal cStat2
As String)
MsgBox("cb_printstatus")
MsgBox(cStat1)
MsgBox(cStat2)
Application.DoEvents()
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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn100.Click
Dim i As Integer = ip.flxNorCardTransaction(1, 150, 578, 0, 0,
150, "first", "second")
MsgBox("Transaction result: " & i)
Thread.CurrentThread.Sleep(3000)
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.flxNorCardTransaction(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_flxPrintStatus(ByVal cStat1 As String, ByVal cStat2 As
String)
MsgBox ("cb_printstatus")
MsgBox (cStat1)
MsgBox (cStat2)
ok = DoEvents()
End Sub
___________________________________________
In VB6 i open the connection, push the 100,- button and the
ip_flxPrintStatus sub immediately pops up a message box with the
status returned from the terminal.
In VB.NET the ip_flxPrintStatus never get executed. If anyone has any
suggestions why, I would be a happy man
__
Tor Inge
Norway