I've beeb playing around a bit with files and stuff to learn some of the aspects of C#. In order to not make it too convenient and easy I opted for using a String to hold my path, and then use DirectoryInfo to use it.

In one of the windows in my app I list all the folders inside the current folder. If you double click one of them, you enter the directory etc etc. My problem is with the first entry, which I made "..". How can I manipulate the string to point to the previous directory? And how can I check if I'm at the root?

Any help would be appreciated!

Cheers :)

9 Years
Discussion Span
Last Post by tiwas

Yup, I know. That's why I didn't want to use it :)


You can probably use something like an ArrayList and keep storing each and every path traversed there. So if you wanna go back, the last path stored will be the last visited and so on.

To check if you are at the root, you can check the number of "\" in the path string....


Yeah, that actually might work. All I'd have to do is split the String on "\\" :)


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.