Global Variable in Multiple Form Instances

Posted on 2003-02-23
Medium Priority
Last Modified: 2010-04-04
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?


P.S. This place is amazing!

Question by:PaulP
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 8002833

  Maybe I misunderstood you, but Did you declare the variable in the private section of your form unit?

Author Comment

ID: 8003413
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?

LVL 22

Accepted Solution

Mohammed Nasman earned 300 total points
ID: 8003501
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.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question