Problem with My.Settings (project)
Settings were intended to be an easy to use feature. I was OK with it, until recent project:
If you find this thread duplicated or similar to a resolved one, Please let me know.
As always
1) Few items were added in "Settings" tab in My Project and after declaring their type (User scope), a default value were set to them.
2) Normally I link them to corresponding controls through ApplicationSettings in property grid, (prior to binding) manually.
3) After running the application, changing values will be saved as we expected and next time machine retrieves last changed values.
Is it wrong? Not a My.Settings.Save() fan.
In recent project - which is a huge one in my world - even though "Save settings after shutdown" is checked, changing the values in runtime will not effect at all. I'm starting to consider this not as a bug, but an unwanted projectsettings side effect, unintentionally. I rather not to trick things but one of the obvious differences (between a demo/test project with a serious one) is that MySettings (with a gear icon) is added to "ProjectExplorer" hierarchy treeview now on, not in the properly-working one.
Plus, One left click on this item (Like other resources in project explorer) in property grid it can eighter be compiled, none, content resource or etc. and also be copied to project location or not. Which is your prefer options?
My goal is to store a COM port name, baud rate and a few boolean conditions related to checkboxes.
Any further clues/information can be attached if needed.
Re: Problem with My.Settings (project)
Can someone at least redirect me to somewhere which Dos and don'ts related to Settings and Bindings are covered? I did them experimentally and didn't pay any attentions to its instruction manual.
Re: Problem with My.Settings (project)
Why do you have a problem with, My.Settings.Save()
You want to save the changes to your setting, that's what is does.
Re: Problem with My.Settings (project)
Absolutely. I don't even use
or reload, or whatever in code.
It is assumed that linking them manually through application property, assigned to controls values will do the matter. But in my case they only show default value however they are user scoped (read/write).
Edit: Question) Now I checked that changing a specific setting in runtime, causes the others to detecting changes. :ehh: Should I use TextChange event and such to save/load all things? I was happy to be away from
Code:
Public Sub New()
InitializeComponent()
InitializeSettings()
End Sub
and
Code:
Private Sub InitializeSettings()
my_digit1 = My.Settings.DIGIT1
End Sub
for every single one and sometimes
Code:
Public Property Low1 As Boolean
Get
Return MYUSERCONTROL.ANYCONTROL.Checked
End Get
Set(value As Boolean)
MYUSERCONTROL.ANYCONTROL = value
End Set
End Property
please tell me there is a simpler solution.