constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); virtual;
Creates an instance of a data module and registers with the global screen object.
CreateNew calls the inherited constructor, and then informs the global screen object of the existence of the data module.
The first argument, AOwner, is the owner of the data module (usually the application). The second argument, Dummy, defaults to 0 and is not used by this constructor. The system passes 0 by default if this constructor is passed only the first argument, AOwner.
CreateNew bypasses the streaming in of the previously associated form file. Therefore, you must stream in an external form file to bind the visual components with their classes. You can stream in the previously associated form file by calling InitInheritedComponent. To stream in a different form file, bracket the call to CreateNew with calls to WriteComponentResFile and ReadComponentResFile. The following code sequence
1. streams out an external form file.
2. creates a new data module disassociated from any form file;
3. streams in the external form file and binds it to this new data module.
WriteComponentResFile('Temp.xfm', DataModule1); ... DataModule2 := TDataModule.CreateNew(Application); ReadComponentResFile('Temp.xfm', DataModule2);