h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Read and Add a Key and Value into Application Configuration file using C#.net

I am creating a Method for Read and Add a Key and Value into Application Configuration file using C#.net.So you call that method in your program(where you want)
Read and Display an Application Configuration file using C#.net
public static void ShowConfigsetting()
{
foreach (string key in ConfigurationManager.AppSettings)
{
string value = ConfigurationManager.AppSettings[key];
string result = "Keys :" + " " + key + " " + "Key value:" + " " + value;
MessageBox.Show(result);
}
}
Add a Key and Value into Application Configuration file using C#.net
public static void AddintoConfigsetting(string appkeys,string appvalues)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add(appkeys, appvalues);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSetting");
ShowConfigsetting();
}