Link to home
Create AccountLog in
Delphi

Delphi

--

Questions

--

Followers

Top Experts

Avatar of Stephen Chamberlain
Stephen Chamberlain🇳🇱

Form throws "Class TLabel not found" exception
Hi Experts,

I have a legacy program form which contains only a few components, a button a label and a textfield. These have been changed from the standard Borland components to Developer Express components, so instead of using TLabel we are using TcxLabel etc. There are no standard 'T' components left on the form. There are no references to them in the source, header or form files.

When this form is loaded at runtime, I get the following error:

"Project program.exe raised exception class EClassNotFound with message 'Class TLabel not found'."

If I compile the form explicitly and re-run the program, the error disappears. However, next time I reboot my system, open Borland Developer Studio and compile/run the program, the error returns.

Does anyone know whats going on here? I don't know why the error comes back, but I suspect it's something to do with BDS auto-managing the form file and loading something it shouldn't.

I should note, a colleague also works on this project but never sees this error. We are using exactly the same source/header/form files. I don't know what is different between our two systems that means his version of the program does not see this error and mine does.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of MerijnBMerijnB🇳🇱

can you either step through the application (debugging) or make it break on delphi exceptions so you can see where the exception is raised (in code) exactly?

you can try to solve it by adding this in your form:

initialization  
  RegisterClass(TLabel);

ASKER CERTIFIED SOLUTION
Avatar of LimbeckLimbeck

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of Stephen ChamberlainStephen Chamberlain🇳🇱

ASKER

Thanks for the replies.

Firstly, I should clarify that the code is C++, I added it to the Delphi zone as I am sure this occurs in Delphi as well, so apologies there.

Limbeck, I have seen RegisterClass(TLabel); online elsewhere, but I haven't found the C++ equivalent. Do you know if there is one? I am also sure that I have the correct paths set, although in my experience 90% of these BDS problems occur from incorrect paths, so I am not ruling it out...

MerijnB -  I am able to step through the code. When the error does occur, it seems to happen when the form is loaded, which I believe happens before the constructor is called (I am not sure about that, I am not a Borland expert). The worst part is, I just tried to reproduce the error and it didn't happen and I know that it will happen when I reboot next.

I will try a reboot and see if the problem comes back and post back. Thanks again for the suggestions.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


i take it the paths you have are the same as your collegue :)

i dont know c++, sorry

goodluck
Ed

Avatar of Stephen ChamberlainStephen Chamberlain🇳🇱

ASKER

They are indeed the same. I just rebooted and the problem has not come back. I still don't accept that it is solved however, it's just a really difficult to reproduce problem.

I will accept your answer about checking your paths though as I am sure it is something to do with that, I just don't know for sure.
Delphi

Delphi

--

Questions

--

Followers

Top Experts

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Developmentâ„¢. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.