This occurs with .Net/VB6 interop when you show a VB6 form with a Web browser control on it before you show a .Net form.  There are several alternative solutions:
  1. Use amServer mode, the last argument to REAPI.Init, if you are using a web application or other non-interactive use. For example,
    Change this:

    REAPI.Init("MYSERIALNUM", "user", "password", 1, "", AppMode.amStandalone);

    to this

    REAPI.Init("MYSERIALNUM", "user", "password", 1, "", AppMode.amServer);
  2. Show a .Net form (such as a messagebox) before calling REAPI.init.
  3. Make a call to the Win32 function “oleinitialize” (which is what #3 would do indirectly).
If the application is for an interactive app then use #3 as shown below:

'Declare this API function to iniitialize COM.
Private Declare Function OleInitialize Lib "ole32" (ByVal reserved As Integer) As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

           'MsgBox("Click to start RE")

           OleInitialize(0) 'only needed if no UI shown before init
           moapi = New BBREAPI7.REAPI

       Catch ex As Exception
       End Try

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.