Go Premium for a chance to win a PS4. Enter to Win

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

Multi-Form Variable

I have a testing program with mutiple Forms and I want to use a variable to record what the tester receves as a score. For example,  in the begining of the program, A = 50. If the tester gets one wrong, A = A - 1. The problem is that A will not retain its value form to form.  I know now that I must put the variable in a Module. I have never used a Module before. How do I do This?
0
R_N_WARD
Asked:
R_N_WARD
  • 5
  • 3
1 Solution
 
MarineCommented:
You can place the variable into a Module(.bas) file. With scope Public It will retain the value on all for all project
0
 
R_N_WARDAuthor Commented:
Say What?!
0
 
R_N_WARDAuthor Commented:
I have never used a Module before. Could you guide me through it?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
R_N_WARDAuthor Commented:
I have never used a Module before. Could you guide me through it?
0
 
Gotcha007Commented:
go to the menu project and choose "add a module"
in this new module, add this line :
global xxx as integer
where xxx is your variable name.

this variable will be accessible on all the project and it will retain his value.


0
 
R_N_WARDAuthor Commented:
Edited text of question.
0
 
R_N_WARDAuthor Commented:
Works Like a charm, Gotcha007. Thank you.
0
 
MarineCommented:
It doesn't have to be a module it can be your standard form. Just in General Declaration place Public x as Integer or in Module Place Public x as Integer.
You can use this variable then thoughout your code.
0
 
MarineCommented:
Global was used previously and only is there for backward compability you shoulduse Public scope variables
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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