hi all
this is my first post here. i have a small question and though i believe its a very simple one, however i cudnt figure it out until now.

i have written a vb 6 code to get data from rs232 port using mscomm control. i am getting the data from the device and its working fine. however i dont know how to stop getting the data. i mean i want a command button which when clicked will stop data collection. rite now what i m doing is i m stopping the entire code when i want to stop data collection.
any help/suggestions would be highly appreciated.
thanks.

This is an example from MSDN

' Close the serial port.
   MSComm1.PortOpen = False

thanks for ur reply. well i tried that.. but it says that it cant be closed until it is open
my code snippet is as follows..

Private Sub cmdStopCollection_Click()
   ' MSComm1.PortOpen = False
End Sub
 
Private Sub Form_Load()
 
   MSComm1.CommPort = 1
   MSComm1.Settings = "9600,N,8,1"
   MSComm1.InputLen = 0
   MSComm1.PortOpen = True
        
End Sub
 
Private Sub Timer1_Timer()
    txtDisplay.Text = txtDisplay.Text & MSComm1.Input & vbCrLf
End Sub

also i wud like to save the data i get from the rs232 into a file and also plot it as the data arrives to the port. any idea how i can do it or whether i can do it?
any help is appreciated.
thanks.

Here is an example of event-driven comm. Learn to do a little research and you can usually (but not always) find good information from google.

If you're getting a message saying that the port is closed then you're probably trying to close it twice and the error happens the second time.

Before closing check that it's actually open.

If MSComm1.PortOpen = True Then MSComm1.PortOpen = False

<<snip>>

commented: spammy hijacker -4