COMException

Joined
Sep 15, 2005
Messages
6
Programming Experience
1-3
when communication with the commport using mscomm32 and the following code is receive the error

-----------------------------------------------------------------------
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in axinterop.mscommlib.dll

Additional information: Exception from HRESULT: 0x800A1F45.
-----------------------------------------------------------------------

the code.
-----------------------------------------------------------------------
' open comms port
mscomm1.CommPort = 1 'control is using COM1
mscomm1.Settings = "9600,n,8,1" 'set up the port parameters
mscomm1.RThreshold = 1 'set the oncomm event to trigger whenever data arrives
mscomm1.PortOpen = True 'open the port << ERROR IS ON THIS LINE

' obtain remote control of Elite 2
blnCheckResult = False
strTest = Chr(64) & Chr(224) & Chr(0)
mscomm1.Output = strTest
------------------------------------------------------------------------

hope someone can help...

if you need any info please ask any help would be very well recieved.

many thanks

Andy
 
thanks for your response i gave this ago but it crashed on the mscomm.open

this is a vb6 example, does anyone know how to achieve the results with .net?

thanks for your help so far, it a good direction :)
 
thankyou for being so much help, i thought id post a bit more info though as its still giving me a headache

the error i now get is

VB.NET:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in axinterop.mscommlib.dll

Additional information: Exception from HRESULT: 0x800A1F52.

now on the mscom.output....

VB.NET:
Try
            With mscomm1
                .CommPort = 1  'control is using COM1
                .Settings = "9600,n,8,1"  'set up the port parameters
                .RThreshold = 1 'set the oncomm event to trigger whenever data arrives
                .PortOpen = True 'open the port
            End With

        Catch ex As Exception
            MsgBox(ex.tostring)
        End Try

        ' obtain remote control of Elite 2
        blnCheckResult = False
        blnExitAll = False
        strTest = Chr(64) & Chr(224) & Chr(0)
        mscomm1.Output = strTest  <<<<<ERROR APPEARS HERE ANY HELP?



hope this might get an extra idea or two???? any help would be brilliant :)

thanks

Andy
 
Back
Top