I am trying to access a VB6.0 DLL with Visual Basic 2005. The VB6 DLL has run for years so I know it works. Below is my VB2005 code. I am getting the following error when I call my RegisterHost function:
"Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"
I am new to Visual Basic 2005 so any help would be greatly appreciated.
oPlugin.RegisterHost(Me) - This is where the error happens.
Public oPlugin As Object
Public Sub InitializePlugins()
oPlugin = CreateObject("Agilent34401A.HIOSplugin")
Function in VB 6.0 DLL I am calling:
Public Sub RegisterHost(CallingForm As Object)
On Error GoTo err
Dim MainForm As Object
Set MainForm = CallingForm
That won't change the fact that the dll is expecting a VB6 Form object and will get a Windows Forms 2.0 object instead. They are different and incompatible, I'm afraid.
There might be some crazy way to marshal a .NET Form as a VB6 Form but I have a feeling it would involve a lot of hassle and not really be worth it. I recognize the name Agilent, and I'm quite certain they have a .NET equivalent to whatever VB6 library is being used here.
If they don't then my company is in better shape than I thought I went to go check their website but (and I don't know if I am glad or not) their web site seems as useless as mine for obtaining anything important.