Message 1 of 10
using COM API in .net dll

Not applicable
05-23-2005
07:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to use the COM API in my .net dll (acad 2005) with C#
I can get the code to work in VB.net but not C#
to get the hosting acad application
'in vba
Public WithEvents m_Acad As AcadApplication
Set m_Acad = AcadApplication
'in vb.net dll
Dim _AcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
in c#.net dll
//Yet converting the vb.net code to C#
//Build gives error CS0029 cannot convert object to Autodesk.AutoCAD.Interop.AcadApplication
private Autodesk.AutoCAD.Interop.AcadApplication _AcadApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
I assume the vb.net code is converting the '.net acad object' to the 'com acad object'
I want to avoid using GetActiveObject("AutoCAD.Application.16")
Thanks
Mark
I am trying to use the COM API in my .net dll (acad 2005) with C#
I can get the code to work in VB.net but not C#
to get the hosting acad application
'in vba
Public WithEvents m_Acad As AcadApplication
Set m_Acad = AcadApplication
'in vb.net dll
Dim _AcadApp As Autodesk.AutoCAD.Interop.AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
in c#.net dll
//Yet converting the vb.net code to C#
//Build gives error CS0029 cannot convert object to Autodesk.AutoCAD.Interop.AcadApplication
private Autodesk.AutoCAD.Interop.AcadApplication _AcadApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
I assume the vb.net code is converting the '.net acad object' to the 'com acad object'
I want to avoid using GetActiveObject("AutoCAD.Application.16")
Thanks
Mark