I would like to have a file in my project which contains variables for use by all classes. I this possible to accomplish efficiently. I have heard that using a module with static varibles could work.

4 Years
Discussion Span
Last Post by Reverend Jim

I'm not sure I understand. Classes shouldn't be using external variables. If you have a file which defines variables and they are used by multiple classes then you are making the inner workings of the classes dependent on external variables. If I've completely missed the point then please elaborate.

Votes + Comments
Modules should be eliminated from VB.NET

I am sorry that I worded my question incorrectly. I am just looking for the best way to store data that I may change in my program, in a central location. Imagine it like an internal configuration file.


You can store data in a file and read/write as required. You can also store data in Settings variables. The Settings variables can be defined as app specific (one variable per app) or per user (each user gets a copy of the variable). Values can be read by

localcopy = My.Settings.variable

and written (saved) by reversing the order of the assignment.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.