Access folder


  • hi i have a folder name 'Data' in my c#.Net Windows application folder i have to use the location of folder, how can i find the location of Data folder through

    code at runtime

    Saturday, May 24, 2008 5:30 AM


  • well, if the "Data" folder is just in the same directory as the windows application (exe) file is, you can just access it by it's name.


    for example, if you want to open a file from this directory, you'll write:

    Code Snippet
    fs = new FileStream(@"Data\test.txt", FileMode.Open);




    notice that i've used the directory name without specifing the whole path, but like the root would be in the place where the exe file is.
    Saturday, May 24, 2008 1:49 PM