tags:

views:

121

answers:

3

I found some resources about how to write a File Browser in C#, but the were all at least 3 years old. I am wondering if importing the shell32 DLL is still the best way to do this. I am a mac developer by trade so please excuse me if my question is a little strange. It just seems this method is going outside of the .NET framework and I was wondering if there is a better way. Thanks

+6  A: 

Sorry if I've misunderstood you, but it sounds like you're trying to create something to scan through directories and get lists of files. If so, then check out System.IO. The File and Directory classes along with FileInfo and DirectoryInfo should give you everything you need.

http://msdn.microsoft.com/en-us/library/system.io.aspx
http://msdn.microsoft.com/en-us/library/system.io.file.aspx
http://msdn.microsoft.com/en-us/library/system.io.directory.aspx

Adam Pope
A: 

You do need to use some Windows specific functionality and go to the Operating System for some of it.

Check out this CodeProject article: http://www.codeproject.com/KB/miscctrl/FileBrowser.aspx

Max Schmeling
Thanks. This is one that I was looking at. Is this still the best approach? I ask because the tutorial is 3 1/2 years old.
Joe Cannatti
+1  A: 

In addition to Adam's System.IO references take a look at Microsoft's OpenFileDialog component for an easy way to allow a user to open and close files.

http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx

clichekiller