Click here to Skip to main content
15,113,692 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
error while loading dwg image System.BadImageFormatException: 'Invalid token.' 

frmDMSViewer is from object
getting error at line
frmDMSViewer = new FrmDMSViewer(filepath);

in frmDMSViewer
cadPictBox.ImageLocation = FileName;

using CADImport dll version 6.3.2942.31648

What I have tried:

tried using CADIMport dll latest version 11
tried building in 32 bit
Updated 14-Jan-21 3:36am

1 solution

Maybe your .dwg file is too new, the dll only supports formats up to 2018,
see: CAD DLL[^]
Member 12966735 14-Jan-21 8:39am
ok but it is throwing error while creating object of the form and for loading the image we have code in frmDMSViewer
cadPictBox.ImageLocation = FileName;

also can you please suggest link that i can use with this 6.3 existing version as when i tried with version 11 it doesnt have cadpicbox.Load or imagelocation method
RickZeeland 14-Jan-21 8:49am
Can't be of much help I'm afraid, I never used that dll and only found this information on Google. Try posting your question on the forum of the manufacturer.
Member 12966735 15-Feb-21 7:56am
Thank you Rick . it was actually issue with the version the older CADImport version was not supporting the dwg file . I have updated the version and now its working
RickZeeland 15-Feb-21 8:46am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900