I am using visual studio.net 2005 to to get the data from an electronic device. Data format from the device is binary. I am using MSCOMM to transfer the data from device into a PC's binary file

I have used the following simple code to get the data

Private Sub MSComm1_OnComm(ByVal sender As Object, ByVal e As System.EventArgs) Handles MSComm1.OnComm
If MSComm1.CommEvent = 2 Then
PrintLine(iFileNumber, MSComm1.Input)
End If

I am getting the data but which is not the one exactly i need . I have used wifi to get the data , It is successful. When we do the file transfer using RS232 , Can anyone suggest where I went wrong?

If you have sample codes for file transferring , Please help