EResNotFound

Top  Previous  Next

DFM-Translator > Creating Forms dynamically > EResNotFound

If all components of a form are generated by code in C++Builder without using the DFM file, the constructor like

 

Form1 = new TForm(this);

 

fails with the meessage:

 

In the project .. an exception of the class EResNotFound with the message 'Resource T... not found' has occurred.

 

 

When using this constructor, the InternalReadComponentRes method is called indirectly. Since the resource is not found, the exception is thrown. Therefore the constructor 

 

Form1 = new TForm(this, 0);

 

has to be used, with the second parameter being a dummy parameter that distinguishes it from the other constructor (in Delphi it is the CreateNew constructor).

 

 

The same problem arises when generating frames dynamically. Unfortunately, the alternative constructor is not defined here. Therefore, a dynamically generated frame must be derived from a specially defined TCustomDynFrame.

TCustomDynFrame is a copy of TCustomFrame that defines the second constructor instead of the first.

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content