保存字符串到.setting变量 [英] Saving a string to a .setting variable
本文介绍了保存字符串到.setting变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的FolderBrowserDialog.SelectedPath保存一个字符串变量()。
I'm trying to save a string variable from my FolderBrowserDialog.SelectedPath().
使用断点,我可以看到字符串被正确加载到SelectedPath(),但我不能保存字符串的.settings文件我的生活。任何帮助吗?
Using a breakpoint I can see that the string is correctly loaded onto SelectedPath(), but I can't save that string to the .settings file for the life of me. Any help?
public void LocateWoWFolder()
{
using (FolderBrowserDialog FileDialogWindow = new FolderBrowserDialog())
{
if (FileDialogWindow.ShowDialog() == DialogResult.OK)
{
//Using a breakpoint here I can see that nothing is loaded to .WoWFolderLocation.
Properties.Settings.Default.WoWFolderLocation = FileDialogWindow.SelectedPath.ToString();
}
}
}
设置WoWFolderLocation是字符串类型,是一个User范围设置。我究竟做错了什么? :P
The setting WoWFolderLocation is string type, and is a User scope setting. What am I doing wrong? :P
推荐答案
您需要调用 Properties.Settings.Default.Save()
。
:)
这篇关于保存字符串到.setting变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文