Getting The folder From the application direcotry
Hi i all i have create a folder with a name XYZ . Now i would like to get that folder path and i would like to save my files in to that folder. How can i get that any help please..
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 7:07 PM EDT
if (!Directory.Exists(@"D:\Muthu\"))
{
Directory.CreateDirectory(@"D:\Muthu\");
}
//To open new save dialogue popup window:
saveFileDialog1.InitialDirectory = @"D:\Muthu\Tech\";
saveFileDialog1.Title = "Sample file";
saveFileDialog1.Filter = "All files|*.*|Text Documents (*.txt)|*.txt";
saveFileDialog1.ShowDialog();
//To save the file without opening a popup window
using (SaveFileDialog saveFileDialog2 = new SaveFileDialog())
{
saveFileDialog2.FileName = @"D:\Muthu\Tech\Sample.txt";
//To write the string value into the new text file
File.WriteAllText(saveFileDialog2.FileName, strValue);
}
Vivekh26 reputationPosted Jun 27, 2010, 9:15 PM EDT
path = System.AppDomain.CurrentDomain.BaseDirectory;
but this is saving the file in bin directory but i need to save i a seperate folder in which my application is running.
Marimuthu ArigovindasamyRank #5,893 · 283 reputationPosted Jun 27, 2010, 9:30 PM EDT
string strAppPath = Application.StartupPath;