1

I am trying to open Dgn File to get data. But I got the error: "Error HRESULT E_FAIL has been returned from a call to a COM component ?" when using OpenFromFile statement, please see my codes:

 Type factoryType = Type.GetTypeFromProgID(
             "esriDataSourcesFile.CadWorkspaceFactory");
 System.Object obj = Activator.CreateInstance(factoryType);
 IWorkspaceFactory factory = obj as IWorkspaceFactory;
 IFeatureWorkspace workspace = (IFeatureWorkspace )factory.OpenFromFile("C:\\DC7.dgn", 0); // Throw Exception

May you help me ?

Regards, Tai

  • In my experience that error message is some sort of default message that comes up when it doesn't know what to say... – Martin Jan 24 '14 at 9:26
  • What format is the DGN? v7 might better than v8 for using in the way. – Mapperz Jan 24 '14 at 15:22
  • Hi everyone, I found out the reason, I should use the directory path (not file name) in the OpenFromFile method – taibc Jan 25 '14 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.