I am using Visual Studio (VB.NET) 2003 to build a very simple application that uses an MSCOMM control to connect to a serial port MSR card reader. The code is supposed to open the port and wait for a card swipe through the card reader. Everythign works fine right now, but the data getting returned is all garbled and I am trying to figure out where I went wrong with reading the data.
The code snippet is attached allong with a print screen of the information getting returned in a message box.
The card that is returning that data should be returning the following instead:
I am very new to MSCOMM so this could be just a setting I have set wrong or something like that, but the fact that the port is opening and returning data makes me believe that the connection settings are correct.
Any help is greatly appreciatd!
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AxMSComm1.PortOpen = True
If Err.Number = 0 Then
MsgBox("Error opening COM port. Please verify MSR is set to COM Port 3.")
MsgBox("Error locating ODBC connection. Please verify ODBC connection has been created.")
Private Sub AxMSComm1_OnComm(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxMSComm1.OnComm
Dim InBuffer As String
Select Case AxMSComm1.CommEvent
InBuffer = CStr(AxMSComm1.Input)
Sub HandleInput(ByVal InBuffer As String)
' This is where you will process your input. This
' includes trapping characters, parsing strings,
' separating data fields, etc. For this case, you
' are simply going to display the data in the TextBox.
txtOCR.Text = InBuffer