11 Vote

Delphi: Declare global variable in DPR and access variable in all units

Question by Compi | 2013-02-09 at 22:23

In a Delphi project, I need a global variable that is visible in all units and which I can access in all units. Therefore, I would like to declare this variable directly in the Delphi project file (DPR). However, I can not access the variable from other units. What am I doing wrong?

2Best Answer2 Votes

I do not recommend declaring variables directly in the DPR because that is contrary to the hierarchy of Delphi.

But I have explained in the tip define global variables in Delphi, how to best declare a global variable in Delphi, so that you can read, write and access this variable in all units, including the DPR.
2013-02-11 at 15:03

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.