MSComm Crashing program, with no error description just closes to Desktop...

Iam communicating with some bowling lane software using a Serial connection ( 9600 baud )

Code for starting communcation
    If frmAccuScore.LaneCom.PortOpen Then frmAccuScore.LaneCom.PortOpen = state
    frmAccuScore.LaneCom.InputLen = 1
    frmAccuScore.LaneCom.InputMode = comInputModeText
    frmAccuScore.LaneCom.CommPort = frmFront.setup_comPort
    Set frmAccuScore.cBuffer = New cCyclicBuffer
    Set frmAccuScore.tBuffer = New cCyclicBuffer
    frmAccuScore.cBuffer.create (100)
    frmAccuScore.tBuffer.create (100)
    If state Then
        frmAccuScore.LaneCom.PortOpen = state
        TermInitialize
        frmAccuScore.timCursor.enabled = True
    End If

Communication can run fine for like an hour but then the program crashes leaving me with nothing but the Desktop

Private Sub LaneCom_OnComm()
    Select Case LaneCom.CommEvent
    Case comEvReceive
        If nnTime.enabled And Not isAdvance Then
            nnTime.enabled = False
        End If
        Dim inp As String
        inp = LaneCom.input
        ReceivingData = True
        Call TermProcessInput(CByte(Asc(inp)))
        DoEvents
    end select
end sub

Does anyone have an idea what is happening or how i can figure out what is going wrong

mSchmidtAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
No idea what is happening. I suggest that you write a trace log to see what is happening.
Does the program loop (no response but consuming CPU time)?
Do ensure that you aren't supressing errors (e.g. On Error Resume Next)
mSchmidtAuthor Commented:
No idea what is happening. I suggest that you write a trace log to see what is happening.
I am doing this at the moment and i have also added some code to ensure that the Input buffer is emptied..
It seems that in peak moments the OnComm event will not be fired however data will be put in the Buffer meaning that the code i currently have takes only one byte from the buffer each time the event is fired...
My new code empties the Buffer everytime the oncomm event is fired..

Does the program loop (no response but consuming CPU time)? <-- It doesnt loop
Do ensure that you aren't supressing errors (e.g. On Error Resume Next) <-- Iam not
GrahamSkanRetiredCommented:
Yes. Just reading the buffer, as you do in your posted code, should empty it.

You could try varying the InputLen.

Also most comm. applications require a timer to monitor and pull the program out of stuck situations.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.