You're confusing COM/ActiveX types with managed types.
There is no AcadApplication or AcadDocument in the
managed API, those are COM objects, not managed types,
so you can't use the MdiActiveDocument property (whose
value is the managed 'Document' type).
You need to use:
Dim WithEvents AcadDoc As AcadDocument = CType(
AcadApp.ActiveDocument, AcadDocument)
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
wrote in message news:5333442@discussion.autodesk.com...
To get all the application and document event handlers in visual studio 2005 I create the following variables at a class level
Dim WithEvents AcadApp As AcadApplication = CType(Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication, AcadApplication)
Dim WithEvents AcadDoc As AcadDocument = CType(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument, AcadDocument)
When I execute the code, It goes fine trought the AcadApps declaration but then it throws a exception at the AcadDoc declaration.
Is there any diference between both objects?
Please advice