Question

How to add a new name in My.Settings?
So far, I've learned how to read and edit values in it, but how can I add another row/name at run-time?

Something like:

My.Settings.AddName.String("foo1")
My.Settings.Save()
My.Settings.foo1 = "fooNew"

I can't see such on the web.. Thanks
EDIT: will be used for the name,text and location of dynamically added buttons.
SeeThisLink

Was it helpful?

Solution

The My.Settings application settings are compiled into your assembly. The properties cannot be altered at runtime because of this. Expecting new settings to be available at runtime through the My.Settings property will not be possible. You would need to resort to more rudimentary techniques like those highlighted by this MSDN question.

OTHER TIPS

You cannot do it at runtime with whats built into my.settings namespace, however its entirely possible. Id love to take credit for this but it has already been answered on stackoverflow.

As long as you know the file path and node name, you can build your own xml parser class to do whatever you want using this very simple example I couldn't write any more clearly:

How to programatically add nodes at certain locations in xml config file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top