Here is something that took me a while to figure out. I haven't seen any questions about it but I can't be the only one who wants to see the values of the Settings. I was trying to make sure my app.config transforms were working so I put a menu entry on my form under "Help" to show the values of the application settings. All of the posts I found kept telling me to use the DefaultValue setting. Finally, I wised up and first got the name of the setting, then used the name to get the value. "MNU002" is the name of the program. Using this, I could check that the transforms put the right values into the Debug, Test, and Release versions of my app.config, depending on the Solution Configuration in effect when I did my Rebuild.
Of course, just using a Setting is as easy as
declare Setting as type MNU002.Properties.Settings
set Setting to new type MNU002.Properties.Settings
move Setting::AOC_ApplicationsServer to ServerName
But I wanted to show a list to the user.
declare Setting as type MNU002.Properties.Settings
set Setting to new type MNU002.Properties.Settings
move "AppConfig Settings - " & x"0d" & x"0a" to strMsg
perform
varying SettingsProperty as type System.Configuration.SettingsProperty
through Setting::Properties
move strMsg
& x"0d" & x"0a" *> CR LF
& SettingsProperty::Name
to strMsg
move strMsg
& " = "
& Setting::Item(SettingsProperty::Name)
to strMsg
end-perform
invoke type MessageBox::Show(strMsg,"MNU002: Show Config Values")
I thought that, at some point, I would like to change the values in app.config and see them immediately in my program, so I found the Reload method:
declare Setting as type MNU002.Properties.Settings
set Setting to new type MNU002.Properties.Settings
invoke Setting::Reload
invoke showConfigValues()
#SettingsProperty
#app.config
#Transform
#setting


