A
Andrew
Hi,
I want to display the list of setting names in my app.config file in a
combobox.
In my app.config file :
<applicationSettings>
<My.Properties.Settings>
<setting name="sSetting1" serializeAs="String">
<value>sSetting1</value>
</setting>
<setting name="sSetting2" serializeAs="String">
<value>sSetting2</value>
</setting>
<My.Properties.Settings>
<applicationSettings>
.....
Code :
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Get sectiongroup
ConfigurationSectionGroup sectionGroup =
config.GetSectionGroup(sectionGroupName);
// Get section
ClientSettingsSection section =
(ClientSettingsSection)sectionGroup.Sections.Get(sectionName);
// Get settings
SettingElementCollection setting = section.Settings;
// Display setting
arlistRSN = new ArrayList();
for (int i = 0; i < setting.Count; i++)
arlistRSN.Add("XXXX");
myArr = (string[])arlistRSN.ToArray(typeof(string));
return myArr;
I could get the Count=2. How do I get the values XXXX to put into my
arraylist ?
Is it possible to get the list of settings from the
"SettingElementCollection" class ?
The values that I pick up should be "sSetting1" and "sSetting2".
cheers,
Andrew
I want to display the list of setting names in my app.config file in a
combobox.
In my app.config file :
<applicationSettings>
<My.Properties.Settings>
<setting name="sSetting1" serializeAs="String">
<value>sSetting1</value>
</setting>
<setting name="sSetting2" serializeAs="String">
<value>sSetting2</value>
</setting>
<My.Properties.Settings>
<applicationSettings>
.....
Code :
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Get sectiongroup
ConfigurationSectionGroup sectionGroup =
config.GetSectionGroup(sectionGroupName);
// Get section
ClientSettingsSection section =
(ClientSettingsSection)sectionGroup.Sections.Get(sectionName);
// Get settings
SettingElementCollection setting = section.Settings;
// Display setting
arlistRSN = new ArrayList();
for (int i = 0; i < setting.Count; i++)
arlistRSN.Add("XXXX");
myArr = (string[])arlistRSN.ToArray(typeof(string));
return myArr;
I could get the Count=2. How do I get the values XXXX to put into my
arraylist ?
Is it possible to get the list of settings from the
"SettingElementCollection" class ?
The values that I pick up should be "sSetting1" and "sSetting2".
cheers,
Andrew