Results 1 to 8 of 8

Thread: Public Constants ???

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Posts
    24

    Post

    i have a question about something, i would think would be easy. for a while now i have been making invisible labels to store values, there has to be an easier way. How do i make a value that can be used by any function?

  2. #2
    Addicted Member
    Join Date
    Jan 1999
    Location
    Sydney,NSW,Australia
    Posts
    178

    Post

    RoundCow, (as opposed to square cow l guess)

    Declare a Global variable in a module calling right at the start of the project

    e.g

    basStart

    Option Explicit
    Global sCompanyName as String

    Sub Main()

    sCompanyName = "Acme Plumbing"

    This will make the variable sCompanyName visible to all forms, modules, classes etc in your project.

  3. #3
    Lively Member
    Join Date
    May 1999
    Location
    Atlanta, GA
    Posts
    75

    Post

    You can declare either global variables or constants.

    If you want them available to all forms/modules in your project, put this in any module.

    Public Const Constant_Name = 1
    Global Variable_Name As String

    Declare them at the top of a form to make them global in that form alone.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Posts
    24

    Post

    i put

    Option Explicit
    global scanstatus as String

    in the declarations, and it didn't work... does it have to be in a bas?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 1999
    Posts
    24

    Post

    coo, i did it in a module and it worked fine. thanks guys.

  6. #6
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    whats the diff between Public and Global?
    cos variables declared with Public in a module are also visible throughtout the project.

    ------------------
    cintel rules
    www.cintelsoftware.co.uk

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

    Post

    Global is an outdated (vb3?)keyword but does the same as Public

  8. #8
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    ah ha

    ------------------
    cintel rules
    www.cintelsoftware.co.uk

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