How to work with My.Settings?

  • Thread starter Thread starter Simon Says
  • Start date Start date
S

Simon Says

Hi all,

I've a class ("Class1"), with an auto-generated a "Class1.exe.config" for
use with the My.Settings function calls.

If my "Class1" is a window form, everything just works fine, i.e., I could
open up "Class1.exe.config", change some values in it, launch my Class1.exe
and all the changes will be reflected.

However, when I changed my "Class1" to a Class Library, nothing works. It
will now auto-generates a "Class1.dll.config", but whenever I change the
values in the config file and re-launch my application, the changes doesn't
get reflected.

I think it must be some settings in VS2005, but just couldn't seems to
figure out what. Pls advice.

Thanks,
Simon
 
Simon,

I don't have 2005 yet and don't know the answer, but my philsophy was that
it's so easy to write my own, and 2003 didn't work like I wanted so I did.

You can get my settings class, which does work at

www.storyitc.com/codesamples

clsPropertyManager (you will need to copy the text to a file with a .vb
extension and add to your project as an existing class.)

The code should be pretty explanatory. Specify the config filepath in the
constructor and true if you want settings read in on the getgo,
then it just uses an item style property to set and get settings. It could
be easily expanded to support groups of settings if you wanted to.

MS may have better with 2005, but if not, you at least know how this works
and have the code.

HTH,

Shane
 
Back
Top