Constant Color Vars

false74

Well-known member
Joined
Aug 4, 2010
Messages
76
Programming Experience
Beginner
I need to put a color as a constant or readonly variable that the entire application can access but not edit. Currently I have a public variable in a module assigned to a color, is it possible to make it a constant variable?
 
First up, the term "constant variable" is a contradiction. Something can be constant or variable but not both. They are complete opposites: one is something that can't change and one is something that can.

As for the question, modules are basically no different to classes. If you want to declare a constant or read-only variable in your module then go ahead and do so.
 
Color is a Structure, which can't be used as a constant type, but you can define a ReadOnly variable or property. ReadOnly (Visual Basic)
Also consider using an application setting with Application scope, this will be a readonly setting. The value can be read application wide from My.Settings object.
 
Back
Top