How to fetch file from a folder within.the application
-
Hello, I have developed an application in c#, i have also done reporting in it. My application contains folder Reports with .rpt files in it. Currently i m giving the report file path as the full system directory path, i want to give the path directly by using my application boundary,not the complete path. how can i fetch the .rpt file path from the Reports folder, Plz help...
-
Hello, I have developed an application in c#, i have also done reporting in it. My application contains folder Reports with .rpt files in it. Currently i m giving the report file path as the full system directory path, i want to give the path directly by using my application boundary,not the complete path. how can i fetch the .rpt file path from the Reports folder, Plz help...
try using Application.ExecutablePath and strip off the .exe file. For example: get the full name of the directory containing your .rpt file. string strExeName = Application.ExecutablePath; FileInfo fleExeFileInfo = new FileInfo(strExeName); string strExeDirName = fleExeFileInfo.DirectoryName; then get the parent directory of the .rpt by using... string strParentDir = fleExeFileInfo.Directory.Parent.FullName; hope this helps....
-
try using Application.ExecutablePath and strip off the .exe file. For example: get the full name of the directory containing your .rpt file. string strExeName = Application.ExecutablePath; FileInfo fleExeFileInfo = new FileInfo(strExeName); string strExeDirName = fleExeFileInfo.DirectoryName; then get the parent directory of the .rpt by using... string strParentDir = fleExeFileInfo.Directory.Parent.FullName; hope this helps....
It worked, thanks alot :)
-
try using Application.ExecutablePath and strip off the .exe file. For example: get the full name of the directory containing your .rpt file. string strExeName = Application.ExecutablePath; FileInfo fleExeFileInfo = new FileInfo(strExeName); string strExeDirName = fleExeFileInfo.DirectoryName; then get the parent directory of the .rpt by using... string strParentDir = fleExeFileInfo.Directory.Parent.FullName; hope this helps....
By any chance are you not aware of
Application.StartupPath
?? Then yo don't have to do all these string manipulations..Regards, Anindya Chatterjee[^]