Hi,
Here is my code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
MyBase.Load
nfileno = FreeFile()
FileOpen(nfileno, "C:\download\test.txt", OpenMode.Append, OpenAccess.Write,
OpenShare.Shared)
With AxNETComm1
..CommPort = CShort(4&)
..set_Settings("9600, E, 7, 1")
..DTREnable = False
..RThreshold = 1
..PortOpen = True
End With
End Sub
Private Sub AxNETComm1_OnComm(ByVal sender As Object, ByVal e As
System.EventArgs) Handles
AxNETComm1.OnComm
With AxNETComm1
Select Case .CommEvent
Case NETCommOCX.NETCommConstants.NETComm_EV_RECEIVE
MsgBox(.InputData, MsgBoxStyle.OKOnly, "Test Application")
Write(nfileno, CStr(.InputData))
'FilePut(nfileno, CStr(.InputData))
End Select
End With
End Sub
I send a formatted text through the serial port. The text is being displayed
in the message box. But test.txt file has several #ERROR 448# strings wriiten
to it after the operation. When FilePut is used, however, nothing is written
to the file!
Writing strings to the file using Write is successful, however writing to
the file the data being received from the serial port fails. MsgBox however
successfully displays the data being sent through the port.
Can anybody out there figure out where the problem lies?
Thanks.