Error Because Com Object Needs Variant Parameter - VB.Net

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im trying to extend a COM object in VB.Net and then make it COM callable again (since you cant extend COM objects in VB6/VBA). The problem is that the base class (a COM object) has numerous read/write properties/members that require a variant type. .NET
is not marshaling these correctly.
The error I get when I try to pass values to these parameters in MS Access says:
Run-time error 3003:
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
<br/>

If youd like to test this heres the code for my entire project. Youll need to have references set for the ADODB library and youll also need to check "Make assembly COM-Visible" under Project Properties > Application > Assembly Information.
<br/>

<pre class="prettyprint lang-vb Imports System.Runtime.InteropServices

<ComVisible(True)> _
Public Class Recordset
Inherits ADODB.RecordsetClass

Public Sub New()

End Sub

End Class
[/code]
<br/>
Any ideas how to make this work?<br/>


View the full article
 
Back
Top