locked
A first chance exception of type 'System.Runtime.InteropServices.COMException

    General discussion

  • Hi friends

    Currently Im developing ECG application in VB.Net using Visual Basic 2005,In the previous version VB 6'
      MsComm is used to access COm1 to COM8 , There are no Upgradation errors or build errors,but there is an exception while debugging 

    A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.MSCommLib.dll

    what is this exception How to solve this. I reffered various forums but I couldn't,

    So I started implementing with serial interface RS232
    i am trying to access COM1 to COM8 using serial interface RS232. here is a code. The errors are
    " Type Rs232 not declared and Name RS232 not Declared" denoted with error.


    Dim moRS232 As New Rs232()

    With moRS232

    .Port = 1 '// Uses COM1

    .BaudRate = 2400 ' // 2400 baud rate

    .DataBit = 8 '// 8 data bits

    .StopBit = Rs232.DataStopBit.StopBit_1 '// 1 Stop bit

    .Parity = Rs232.DataParity.Parity_None '// No Parity

    .Timeout = 500 '// 500 ms of timeout admitted to get all required bytes

    End With

    '// Initializes and Open

    moRS232.Open()

    'ou can, optionally control the state of DTR/RTS lines after the Port is open

    '// Set state of RTS / DTS

    moRS232.Dtr = True

    moRS232.Rts = True




    please give your suggestions in either of the cases.

    Thanks for reading this forum

    Thursday, June 26, 2008 2:39 PM

All replies

  • Hi Leelamutyala,

    You can use the SerialPort class to replace the MsComm component in this scenario. Visit this tutorial about using this class.

    Best regards,
    Riquel

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, June 30, 2008 12:03 PM