delphivcldelphi-xe4

Error opening a dfm file - Class xxxx not found


While opening a dfm file by double clicking, I am getting following error:

Class TMyClass not found. Ignore the error and continue? Note: Ignoring the error may cause components to be deleted or property values to be lost.

When I click Cancel, I get following message

Error creating form: Class TMyClass not found.

When I click OK now, pas file is opened only.

In pas file MyClass unit is added (which conatins the TMyClass defination) and its path is also added in my search path (Ctrl clicking on unit name, takes me to the unit file)

Everything is fine as per me. I don't know why I am getting this error and why am I not able to open this dfm file in RAD studio? Please help.


Solution

  • To create the component (that you placed on the form) Delphi IDE should know it by name and have its class loaded into memory. That means - it should have that component compiled into binary runtime package and that corresponding design-time package should be loaded into IDE and during the loading it should call RegisterComponent.

    Usually this all is done during the library installation. So if you have that library for Delphi 7 now just install it for Delphi XE4 as well.

    If your library does not have installer or that installer does not know XE4, then you have to register those components manually, just like Delphi documentations asks you to do. That is a multi-step process, so you maybe would need to re-do it from starters. However with any luck you would probably be able to reuse the work already done for Delphi 7. At best case you only would have to recompile runtime and designtime packages in XE4 and then install those design-time ones into newer IDE.