global constants?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

Where do I declare constants that I want to be visible *outside* of the
application. Or does this only work with enums?

I've declared constants in a normal modue, which can be see throughout the
application, but not from an application referencing this application.

Thanks,

Craig
 
Craig Buchanan said:
Where do I declare constants that I want to be visible *outside* of
the application. Or does this only work with enums?

I've declared constants in a normal modue, which can be see
throughout the application, but not from an application referencing
this application.

Did you try to qualify the name? A module is only imported by default in the
same project, not in referencing projects.

General: A constant can be declared as
- Structure member
- Class member
- Module member
- local constant (at procedure level)

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Sure, you can declare it in a public class or public module. Be sure to use
Public for the const itself. For example,

Public Class Class1
Public Const ClassConst As Integer = 1024
End Class

Public Module module1
Public Const ModuleConst As Integer = 2048
End Module


In the client app, you would reference these as:

ClassLibrary1.Class1.ClassConst and ClassLibrary1.ModuleConst




Sincerely,

Keith Fink
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights
 
* "Craig Buchanan said:
Where do I declare constants that I want to be visible *outside* of the
application. Or does this only work with enums?

I've declared constants in a normal modue, which can be see throughout the
application, but not from an application referencing this application.

Are you sure you marked them to be 'Public'? And you declared them in a
'Public' type?
 
Back
Top