CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    Germany
    Posts
    487

    how to define kind of global constants?

    Hi!

    What is the VB-Version from the c-statement:

    in a.h:
    #define home 0
    #define guest 1

    in b.h:
    #include a.h


    I try to use an enum, but the problem I'm facing is, that I do not have the definend enum-type available in another form or dialog.

    In other words:
    How can I define project-wide (global) constants?


    Thanks in advance!


    Marc

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: how to define kind of global constants?

    Put the PUBLIC variables into a MODULE and they will be global to your program.
    Code:
    Public Home as Integer = 0
    You can use CONST (not sure about globally)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured