AutoCAD 2010/2011/2012 DWG Format
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Error : Exception has been thrown by the target of an invocation
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
441 Views, 1 Replies
01-09-2012 12:51 AM
Hi,
I have written an external application to drive autocad with a dll that was registered for COM. I have followed this codes to write my application however i have replaced the following code with AddNumbers() method:
public string OpenDWGFile(string MyDWGFilePath)
{
DocumentCollection dm = Application.DocumentManager; Document doc = null; if(File.Exists(MyDWGFilePath)) { doc = dm.Open(MyDWGFilePath, false); Application.DocumentManager.MdiActiveDocument = doc;
return "This file is exists";
}
else
return "This file is not exist";
}
but when i run my application the autocad software open and then close immediatly and this error message is shown : Exception has been thrown by the target of an invocation.
but if i comment the following lines of my code the application works without any errors:
doc = dm.Open(MyDWGFilePath, false); Application.DocumentManager.MdiActiveDocument = doc;
please help me.
Solved! Go to Solution.
Re: Error : Exception has been thrown by the target of an invocation
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-11-2012 01:51 AM in reply to:
M_Mogharabi
Hi everyone,
I have solved my problem by using this updated code instead of previouse code.
