Results 1 to 5 of 5

Thread: Dimming As Global??

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Aus
    Posts
    2

    Post

    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!~*

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    in a Module

    Public x as Integer


  3. #3
    Hyperactive Member
    Join Date
    Dec 1999
    Posts
    321

    Post

    In the Declarationns section on a form:

    Dim MyVar as Long

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

  5. #5
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    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
  •  



Click Here to Expand Forum to Full Width