Can I use a DataModule in a Delphi console application?

Can I use the DataModule form in a Delphi console application?

I tried to include an existing module / form in the Delphi console application in the uses clause, but DataModule1 is allowed to zero (not initialized).

+4
source share
1 answer

Just thought that after looking at the Form application, I just need to do the initialization manually:

Application.CreateForm(TDataModule1, DataModule1); 

UPDATE

As suggested in the comments, I ended up implementing:

 DataModule1 := TDataModule1.Create(nil) 
+7
source

All Articles