Home | RS485 | PC Interface Books | HOW-TO-SERIAL PORTs | HOW-TO-PARALLEL PORTs | Interface LINK |

Computer Hardware Interface MSComm Events MSComm Control Programming Example

MSCOMM Events How to Programming with MSComm Control use MSComm onCom Events.

The MSComm control can use polling or an event-driven method to retrieve data from the port. This simple example uses the polling method. For an example of the event-driven method, see help for the OnComm event.

The following example shows how to handle communications errors and events. You can insert code after each related Case statement, to handle a particular error or event.

Private Sub MSComm_OnComm ()
Select Case MSComm1.CommEvent
' Handle each event or error by placing
' code below each case statement

' Errors
Case comEventBreak ' A Break was received.
Case comEventFrame ' Framing Error
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParity ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]

' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of
' chars.
Case comEvSend ' There are SThreshold number of
' characters in the transmit
' buffer.
Case comEvEof ' An EOF charater was found in
' the input stream
End Select
End Sub

 

'Visual Basic Code

 

Related Link : MSComm Event More article and Resources Serial Port Programming

From: http://support.microsoft.com/default.aspx?scid=kb;en-us;823179

MSComm Events Back to TOP Back to HOME