1
votes

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.

3
Show some details please. Cut down .pas and .dfm please.David Heffernan
You've got this tagged both as Delphi 7 and Delphi XE4. Which is it?user743382
Actually, that may not be relevant. Have you made sure to install the TMyClass component so that you can use it at design-time too?user743382
@hvd - Its Delphi XE4.user1556433

3 Answers

11
votes

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.

0
votes

This problem occurred to me after a new version of Windows 10; I adjusted by changing the permissions of my executable. I just removed the notification permissions and added it again;

https://support.microsoft.com/en-us/windows/change-notification-settings-in-windows-10-ddcbbcd4-0a02-f6e4-fe14-6766d850f294 for more details;

0
votes

For me, this error happen when a visual control was declared as TSomething in the pas file and as TSomethingElse in the DFM file.

The solution was to manually edit the DFM file and put the control declaration to the correct value (TSomething).