VB2010. I understand how to save settings and load them from the My.Settings namespace. I am trying to figure out how to get the default value for the parameters and present it to the user. I do not want to save the settings, I just want to show what the current value is and what is the default value. I tried this, but I don’t think it is doing what I think should do:
Msgbox "Current setting: " & My.Settings.CustLineWidth & vbcrlf & _
"Default setting: " & My.MySettings.Default.CustLineWidth
By default, when I have a setting in the IDE, 10, but the user changed it to 25. If I run the code above, I get
Current setting: 25
Default setting: 25
I would like
Current setting: 25
Default setting: 10
Solution: I repeat all the settings and print the current value and a default value like this
For Each prop As Configuration.SettingsPropertyValue In My.Settings.PropertyValues
Debug.Print("Name={0}", prop.Name)
Debug.Print(" Value ={0}", prop.PropertyValue.ToString)
Debug.Print(" Default={0}", prop.Property.DefaultValue.ToString)
Next prop
source
share