string path = @"c:\ClientSet\ClientSet.ini";
// This text is added only once to the file.
if (!File.Exists(path))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(textBox1.Text);
sw.WriteLine(textBox2.Text);
}
} 编译报错:未处理的“System.IO.DirectoryNotFoundException”类型的异常出现在 mscorlib.dll 中。其他信息: 未找到路径“c:\ClientSet\ClientSet.ini”的一部分。
这是什么原因,急死了!
// This text is added only once to the file.
if (!File.Exists(path))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine(textBox1.Text);
sw.WriteLine(textBox2.Text);
}
} 编译报错:未处理的“System.IO.DirectoryNotFoundException”类型的异常出现在 mscorlib.dll 中。其他信息: 未找到路径“c:\ClientSet\ClientSet.ini”的一部分。
这是什么原因,急死了!
string path = @"c:\ClientSet.ini";就可以了
在建立文件之前需要先建立好目录吧??