Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with variables

Status
Not open for further replies.

The

Programmer
Jul 30, 2001
92
CA
I'm making a program with multiple forms. When I change a variable's value in one form, it doesn't change in the rest. I declared the variable in a module, not just one form. How can I fix this?
 
I doubt it.....How would I do that?
 
Nevermind, I figured it out
 
Hi,
Public MyVar as Integer

But how do you know it doesn't change? What are you actually doing with the variable, can you post some code?

Jon
 
"I declared the variable in a module, not just one form. How can I fix this?"
He probably defined it in BOTH the form and a module otherwise he would not have gotten beyond a "Variable Not defined" error.
Compare Code (Text)
Generate Sort in VB or VBScript
 
Well, I'm sort of making a game, just to try some things out. On one form, you get to choose to have either the laser gun or the freeze ray. On the next, you go into battle (a different form). If you chose the laser gun (via clicking the "Laser Gun" command button) it changes the variable "Laser" to true, and in the battle form you can use the laser gun, and the same goes for the freeze ray.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top