The right SerialOnCom sequence

Put Claude

Active Member
Licensed User

What is the right SerialOnCom sequence, do I set it BEFORE opening the port, or AFTER opening the port.
When I will close the port, what have I to do with SerialOnCom, and when must I do It?
With code like this:
If serial.PortOpen = True Then serial.PortOpen = False
or the opposit,
do I have to do something with SerialOnCom to(set are close)

I think there is a sequence that must be followed...
Anybody nows how?

I ask this because in opti-compile my pocket hangs when I close the GPS app...
Has something to do with closing the port and SerialOnCom sequence.
But can also be the fact that I do close the port in the scope of 'Sub Form1_Close'
Empty the scope, and place 'close the port' in another place has resolvet the problem, but I do not now why...

Put Claude Belgium


Active Member
Licensed User
I don't know neither but...

Under a condition (true or false)
In Form1_Close close your port.
After that run CancelClose in Form1_Close.
Set a Timer (100 ms lets say).
Inside timer event toogle the condition and run Form1.Close
Now in Form1_Close just allow your app to close normally.

Put Claude

Active Member
Licensed User
hi dzt,

Your sugestion is in fact, wait, do exit-things first, then let go the Form1_Close...
I took al exit-things out of the Form1_Close, and place them in a Button_click to do exit things first, then let go the Form1_Close without any thing to do in it, it works...

Put Claude Belgium