Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Global Variable in Multiple Form Instances

Hello All!

I have a little problem with my app...

I need to create multiple instance of the same form,
The form is a touch panel with a variable array of buttons. Each form gets different data on how much button to create...

All this work except that I declare global variables in the unit and now I realize that these varialbe are actually shared to all instance of form...

So the question is how do I go to have global variable in a form?

Thanks!

P.S. This place is amazing!

0
PaulP
Asked:
PaulP
  • 2
1 Solution
 
Mohammed NasmanSoftware DeveloperCommented:
Hello

  Maybe I misunderstood you, but Did you declare the variable in the private section of your form unit?
0
 
PaulPAuthor Commented:
Ok I found the error, I assiged the Form ID to the Tag property, but it wasn't set properly before the actual data was pulled from the TList... so the index was always 0...

But Should these global variable be decalre in the Private or Public section of the unit?

Is this approach OK?

0
 
Mohammed NasmanSoftware DeveloperCommented:
if you would the variable to be public for the project declare it in the public, variables in private will be access only within the class where they declared in.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now