
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I am going to run a sample code that generates polylines in the following environment.
[Environment]
VS 2019 communication, ACAD 2018, .NET Framework 4.7.2
[sample code]
I installed objectARX 2018 to add acax22ENU.tlb and axdb22enu.tlb to the reference in Solution Explorer, and added also AcCorMGD.dll, AcCui.dll, AcDbMgd.dll, and AcMgd.dll.
Then I inserted the create polyline example code in the event of button1_Click, which is causing a problem from here.
Private void button1_Click(object sender, EventArgs e)
{
Document acDoc = Application.DocumentManager.MdiActiveDocument; // issue. Application is an ambiguous reference between Autodesk.AutoCAD.ApplicationServices.Application and System.Windows.Forms.Application.
So, I avoided the syntax error by explicitly changing it like this:
Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
However, when I run the application and press button1, error occurs that "Common Language Runtime detected an invalid program." in the modified line.
I would appreciate if you let me know where I made the mistake.
Solved! Go to Solution.