You don't offer enough details, but I'm guessing your are trying to do something like this:
using (OpenFileDialog ofd = new OpenFileDialog())
{
if (ofd.ShowDialog() == DialogResult.OK)
{
string parseResults = ParseThisFile(ofd.FileName);
File.WriteAllText(Path.GetDirectoryName(Application.ExecutablePath) +
@"\excelfiles\" +
Path.GetFileName(ofd.FileName),
parseResults);
}
}
Note: no error checking.
Also, it probably isn't a good idea to save these parsed files in a subdirectory of the executable. You probably want to use Environment.SpecialFolder.etc for that.
发布评论
评论(1)
您没有提供足够的详细信息,但我猜您正在尝试做这样的事情:
注意:没有错误检查。
此外,将这些已解析的文件保存在可执行文件的子目录中可能不是一个好主意。您可能想为此使用Environment.SpecialFolder.etc。
You don't offer enough details, but I'm guessing your are trying to do something like this:
Note: no error checking.
Also, it probably isn't a good idea to save these parsed files in a subdirectory of the executable. You probably want to use Environment.SpecialFolder.etc for that.