Home All Groups Group Topic Archive Search About

Add User settings to My.Settings at Runtime

Author
12 Apr 2006 2:29 AM
Shane
Does anyone know how to add user scoped settings to My.Settings at runtime?

I know how to use the 'My Settings' designer to add user settings at design
time. I also, know how to create a class that inherits from the
ApplicationSettingsBase where you can define your own settings with their
default values, at design time. But, these are all done at design time which
aint want i need.

I've tried using the My.Settings.Properties.Add method, but that doesn't
seem to work? is it supposed to?

I'm guessing i'll need to have a user scoped collection setting that allows
me to add settings to it and then serializes the collection. This seems a bit
wrong though.

Cheers

Author
12 Apr 2006 6:46 AM
MSMVP KenLin for VB.NET
Dear Shane,

As I think, there are 2 ways to add user Setting for my.settings, but both
are under design time,

1) using Project Designer
2) Properties Windows

And there is a sentence from the .NET Documentation,
========
The My.Settings object provides access to the application's settings and
allows you to dynamically store and retrieve property settings and other
information for your application
========

--
Hope this help and welcome to reply the testing result.

Regards
Ken Lin, Kam Hung
Founder and VP of Hong Kong .NET User Group(http://HKNetUG.com)
MCP, MCP+I, MCDST, MCSA, MCSE(NT4 & win2k),
MCSE+I, MCDBA(SQL7 & SQL2K), MCSD(VB6 & .NET), MCAD(.NET)
Microsoft Community Star(Hong Kong & Taiwan)
Microsoft Most Valuable Professional(.NET since 2003)
MCT2004 & 2005


Show quoteHide quote
"Shane" <Sh***@discussions.microsoft.com> wrote in message
news:A43C8113-1DF6-481F-A458-48973E470C59@microsoft.com...
> Does anyone know how to add user scoped settings to My.Settings at
runtime?
>
> I know how to use the 'My Settings' designer to add user settings at
design
> time. I also, know how to create a class that inherits from the
> ApplicationSettingsBase where you can define your own settings with their
> default values, at design time. But, these are all done at design time
which
> aint want i need.
>
> I've tried using the My.Settings.Properties.Add method, but that doesn't
> seem to work? is it supposed to?
>
> I'm guessing i'll need to have a user scoped collection setting that
allows
> me to add settings to it and then serializes the collection. This seems a
bit
> wrong though.
>
> Cheers
>
Author
12 Apr 2006 7:36 AM
Shane
So, you're saying there is absolutely no way to add settings at runtime?

My reason for needing this feature is to store settings for a pc's mixer
controls (ie. master volume, wave volume etc). I basically enumerate all
mixer controls and store their settings. Available mixer controls vary from
pc to pc, so there is no way i can know their settings at design time.

Cheers