Click to See Complete Forum and Search --> : Handling Run Time Errors


October 15th, 1999, 07:58 AM
How do you handle run time errors ?
The code I have included works if 'MSComm1.CommPort = 1'.
When 'MSComm1.CommPort = 2' it throws up a run time error on certain machines where com port 2 is not available.
How can I handle this error so that I give an error message say port not available and the program can carry on ?



private Sub OptStart_Click()

pac = 0
state = 0
execute = 0

Timer1.Enabled = true 'START TIMER

MSComm1.PortOpen = true 'OPEN COMM PORT

static_send_packet 'SEND PACKET

End Sub

Crazy D @ Work
October 15th, 1999, 08:23 AM
Check the helpfile for "on error", it will explain it pretty well what you can do to catch errors (on error resume next, or on error goto <label>...)

Crazy D @ Work :-)

October 15th, 1999, 08:58 AM
Thanks for the help