DataSet dx = new DataSet(); dx.ReadXml(Application.ExecutablePath + ".config", XmlReadMode.InferSchema); DataRow[] dtTmp = dx.Tables["setting"].Select("name = 'DepartName'"); dtTmp[0]["Value"] = txbxTitle.Text; dx.WriteXml(Application.ExecutablePath + ".config"); //刷新应用程序设置,这样下次读取时才能读到最新的值。 Properties.Settings.Default.Reload();