Some of the sources I've checked already:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual%5FBasic.NET/Q%5F23359339.html
http://mygreenpaste.blogspot.com/2006/03/net-framework-20-configuration-tool.html
http://support.microsoft.com/kb/186063
I'm busy developing .NET modules that will hook into our existing VB6 code. I've created a test VB6 project from which to launch the new code which comprises of a form with a button, and on the button's click event is
Dim launcher As New VB6InteropLaunchPad.launcher
launcher.FormTypeEnum = FormTypeEnum_MySpecificForm
launcher.launchAppropriateForm
It is successful the first time I click the button. However, if I click the button again, I get the following error:
Run-time error '-2146233079 (80131509)': Automation Error
Subsequent calls to the .NET code fail with the same error message unless I close and restart the IDE. If I compile the VB6 project to an EXE the same thing happens. I have to close the EXE and run it again to be able to access the .NET code.
I've tried the suggestion on http://support.microsoft.com/kb/186063 and did the following: Option Explicit
' http://support.microsoft.com/kb/186063
Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Private Declare Function FormatMessage Lib "kernel32" Alias _
"FormatMessageA" (ByVal dwFlags As Long, lpSource As Long, _
ByVal dwMessageId As Long, ByVal dwLanguageId As Long, _
ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Any) _
As Long
Private Function MessageText(lCode As Long) As String
Dim sRtrnCode As String
Dim lRet As Long
sRtrnCode = Space$(256)
lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, lCode, 0&, _
sRtrnCode, 256&, 0&)
If lRet > 0 Then
MessageText = Left(sRtrnCode, lRet)
Else
MessageText = "Error not found."
End If
End Function
On Error GoTo errHandler
Dim launcher As New VB6InteropLaunchPad.launcher
launcher.FormTypeEnum = FormTypeEnum_MySpecificForm
launcher.launchAppropriateForm
Exit Sub
errHandler:
MsgBox MessageText(Err.Number)
MsgBox Err
but the error was not found.
Any ideas on how to fix this? I tried to set launcher = Nothing
but it doesn't help.
Thanks guys.