Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘type’

BUG: Error “Unable to Register MSADO15.TLB” If You Use a PDW Package to Install a VB Application

Symptoms
When you use a package that you created with the Package and Deployment Wizard (PDW) to install a Visual Basic application, you may receive the following error message (or similar) during the installation:

Unable to register MSADO15.TLBThis error message may reference any of the following files:MSADO15.TLBMSADO20.TLBMSADO21.TLBMSADO25.TLB
Resolution
The Package and Deployment Wizard adds the type library (.tlb) file to the package because the type library is referenced in your project. The PDW also erroneously assigns the $(DLLSelfRegister) registration macro to the type library in the Setup.lst file that is created for your installation package.
Most commonly, this problem occurs when your Visual Basic project contains a reference to a version of ActiveX Data Objects (ADO) that is earlier than the latest installed version. The reference for the latest installed version of ADO points to MSADO15.DLL. Earlier version references point to the above-mentioned ADO type library files.

BUG: “InteropServices.COMException” error message occurs when you pass ByRef Parameters by using late binding

Symptoms
When you call a COM component in Visual Basic .NET, and you use late binding, you may receive the following error message:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in microsoft.visualbasic.dll. Additional information: Type mismatch.This behavior occurs when all the following conditions are true: The method that is called is a Public method in the COM component. The method takes a ByRef parameter of type Object.You use late binding to call the COM component.
Resolution
When you run an application, the .NET Framework late binding mechanism tries to pass the ByRef parameters to the COM component as objects. The COM component expects the parameters to be of the type IDispatch. The .NET Framework raises a type mismatch exception. This occurs because the .NET Framework cannot convert the uninitialized objects to the IDispatch type. The early binding signature of the method in the COM component follows:

[id(0x60030000)]HRESULT MyFunc([in, out] IDispatch** var1);