在Properties.Settings中可以把一个变量Scope设成Application的或者是User,我是向读取Settings中的初始值并且再保存进去,Application的不能保存,而User的可以,但却没保存在我的那个Settings中,而是保存在了我的本地用户的C:\Documents and Settings\lile\Local Settings\Application Data\中了,我想问问各位高手能不能设置保存的目录,或是直接能保存在Properties.Settings中啊?
解决方案 »
- 学习.NET要学习那些框架技术
- C#读取文件并使用问题
- 删除一个泛型集合中的元素问题
- 累,控件如果用同一个同一个Click EventArgs区分。
- this.Controls.Add(listBox1);中的this是什么意思
- udpClient的send和receive是不是要使用线程?
- 关于AppDomain的问题
- 哪位大侠使用过SQL CE?
- BinaryReader “(br.BaseStream).ReadTimeout”引发了“System.InvalidOperationException”类
- 选择MSSQL数据库中numeric字段会在小数数字中出现0,怎样屏蔽掉0
- c# Excel分页符
- 不同类型之间的强制转换
...能不能设置保存的目录then how do you know other users' folder structure?
不妨重新读取该xml文件 然后进行写入操作。
譬如 你创建一个scope为user的变量CONST_USERNAME的话,初始值是"default" 你想把它改成"changed" XmlDocument propertyXml = new XmlDocument();
propertyXml.Load(Application.ExecutablePath + ".config"); //读入[应用程序名.exe.config]文件XmlNode settingNodes = propertyXml.SelectSingleNode
("/configuration/userSettings/WindowsApplication1.Properties.Settings");//此处根据你的xml文件,节点名称会有所不同for (int i = 0; i < settingNodes.ChildNodes.Count; i++)
{
if (settingNodes.ChildNodes[i].Attributes["name"].Value == "CONST_USERNAME")
{
settingNodes.ChildNodes[i].ChildNodes[0].InnerText = "changed";//修改设置的值
break;
}
}propertyXml.Save(Application.ExecutablePath + ".config");//保存[应用程序名.exe.config]文件