• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

Global Variables

What is the command in VB6 to set a variable in a module?

I want to say:
Variable1 = 25
but I don't remember how to say that...
0
JFrye
Asked:
JFrye
  • 2
1 Solution
 
pyromattCommented:
If the variable is global you should be able to say just that. To declare it globally you just use the following;

Global Variable1 as Integer
0
 
JFryeAuthor Commented:
I have that much, but I need to set the value of Variable1 to 25 in this example. How do I set the value?
0
 
TomLaw1999Commented:
If the value is constant available to all forms then

Public Const Variable1 As Long = 25

_____________________________

if it is a true Public variable then
Public Variable1 As Long

Then enter the value 25 in an appropriate place i.e.

sub Main()
Variable1 = 25
end sub






0
 
JFryeAuthor Commented:
Oh yeah! The SubMain() was what I was looking for. Thanks!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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