You are passing an AcadDatabase COM object, and
expecting to receive a Database managed wrapper
for AcDbDatabase. I don't think so.
If you're making an assumption like that, then I
would suggest making an investment in learning
a bit more about the .NET managed wrapper API,
before attempting any significant development
with it, beyond simple band-aids. Contrary to
what may have been implied by 'managed', the
possiblity of crashing AutoCAD is quite good even
with the safety net provided by managed code.
See the Database.FromAcadDatabase() method.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Terry W. Dotson" wrote in message news:5111860@discussion.autodesk.com...
I'm trying to use VBA to call a VB.NET sub, and pass a drawing database
as a parameter. I've included a string passed MyTestSub1 to verify that
the communication is there, and the alert dialog shows.
However when trying to pass a drawing database I get an error indicating
it "does not support expected interface".
Can "db As Autodesk.AutoCAD.DatabaseServices.Database" be used as an
incoming parameter?
Thanks in advance,
Terry
==================================================================
.NET Code
---------
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices
Public Class MyTestClass
Public Sub MyTestSub1(ByVal mystr As String)
Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(mystr)
End Sub
Public Sub MyTestSub2(ByVal db As
Autodesk.AutoCAD.DatabaseServices.Database)
db.RetainOriginalThumbnailBitmap = True
End Sub
End Class
VBA Code
--------
Dim MyRef As Object
Set MyRef = Application.GetInterfaceObject("MyProject.MyTestClass")
MyRef.MyTestSub1 "Hello from VBA"
MyRef.MyTestSub2 ThisDrawing.Database