如何在winform 中修改app.config的值?
如何在winform 中修改app.config的值?
------解决方案--------------------
可以用写文件的方式,如:
   public static bool WriteXml(string strKey, string strValue, string strFileName)
       {
           //写配置
           try
           {
               XmlDocument doc = new XmlDocument();
               doc.Load(strFileName);
               XmlNode xAS = doc.SelectSingleNode("/configuration/applicationSettings");
               XmlNode xNode = xAS.SelectSingleNode(String.Format("//setting[@name='{0}']", strKey));
               foreach (XmlElement xEle in xNode)
               {
                   if (xEle.Name == "value")
                   {
                       xEle.InnerText = strValue;
                       break;
                   }
               }
               doc.Save(strFileName);
               doc = null;
               return true;
           }
           catch
           {
               return false;
           }
       }
------解决方案--------------------
作用域为“用户”的可以直接在程序里调用Properties.Settings.Default.Save()保存。