Click to See Complete Forum and Search --> : Dimming As Global??
*~Kezza!~*
Jan 26th, 2000, 03:36 PM
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!~*
Mark Sreeves
Jan 26th, 2000, 03:40 PM
in a Module
Public x as Integer
Rodik
Jan 26th, 2000, 03:43 PM
In the Declarationns section on a form:
Dim MyVar as Long
Mark Sreeves
Jan 26th, 2000, 03:50 PM
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
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
Buzby
Jan 27th, 2000, 11:55 AM
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
BuzbyB@HotMail.Com
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.