Unloading userform in MSComm event

S

Sunny

Hi,

I'm using the MSComm function to communicate with a
microprocessor. Everything works fine except for one
thing:
at the end of my MSComm_OnComm() sub, I prompt a simple
message box, and after that message box, I want to close
the form (which has the MSComm control on it). Whenever I
include the Unload userform line after the message box
line, I get an error (actually, the entire VB shuts down
and an error log is created). Of course when I don't use
Unload userform, everything works fine. The
microprocessor is not sending any data at the time
either. It seems the error is occuring because the
userform is closing before the MSComm control has
stopped. What's going on here? Any help would be
appreciated. Thanks.

Sunny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top