im implementing this tool that will enable the user to specify a certain excel file that i am parsing and doing some work with ... (Windows form application .net C#) i want to save, the file that the user is choosing(locally) using the openfiledialoge, automatically in a certain directory where the .exe file exists example ../excelfiles/
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.