|
-
Jan 26th, 2000, 04:36 PM
#1
Thread Starter
New Member
Hi! i read somewhere ages ago how you can dim something as global so that you can access it in different subs..but i cant remember how to do it. can anyone plz tell me
like i want to dim x as a global integer but it comes up with compile error: expected: New or type name
------------------
*~Kezza!~*
-
Jan 26th, 2000, 04:40 PM
#2
Frenzied Member
in a Module
Public x as Integer
-
Jan 26th, 2000, 04:43 PM
#3
Hyperactive Member
In the Declarationns section on a form:
Dim MyVar as Long
-
Jan 26th, 2000, 04:50 PM
#4
Frenzied Member
Depends what scope you require,
Rodik's reply will make it accessable to all parts of the form whereas mine will be accessable to all forms and modules.
You shouldn't really use a Public in a module if it is only used in one Form, so take your pick!
------------------
Mark Sreeves
Analyst Programmer
[email protected]
A BMW Group Company
-
Jan 27th, 2000, 12:55 PM
#5
Frenzied Member
Or, to be really naughty put
Global [variable] as [type]
in the declarations section of a module. Then it is visible to everything in the program. Sometimes this can be quite useful though 'real' programmers don't tend to use too many of them...
------------------
Mark "Buzby" Beeton
VB Developer
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|