Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use a DataModule in a Console Delphi Application?

Tags:

delphi

Can I use a DataModule form in a Console Delphi application?

I tried including an existing unit/form to a console Delphi application in the uses clause, but DataModule1 is resolved to nil (not initialized).

like image 471
Pep Avatar asked Feb 18 '23 11:02

Pep


1 Answers

Just figured that by looking at a Form application that I simply need to do the initialization by hand:

Application.CreateForm(TDataModule1, DataModule1);

UPDATE

As suggested in the comments, I ended up implementing:

DataModule1 := TDataModule1.Create(nil)
like image 185
Pep Avatar answered Mar 05 '23 16:03

Pep