how to show a windows folder contents in a windows form using .NET?

i want to show the folder contents in my windows form from where user can copy paste the files user needed, what type of container i have to use for this purpose?

Answers


Basically you have two options. You can get an already build control and use it in your application, there are lots of them but not very good and you'll have to pay for one.

Or you could use a TreeView / ListView and build your own control that will suite best what you need. Here is an example explained and with source code.


Another alternative is you can get the Windows API Code Pack which contains a managed wrapper for the actual explorer shell control which basically allows you to embed explorer directly in your application.


before i used Ultra win tree(infrajestics control) to view all files with in the tree view.


Consider using the FolderView and FileView controls from Shell MegaPack.


Assuming :

  1. the design requirements prohibit showing the actual location of the files the end-user can copy or paste. Assume all file names shown are stripped of their path locations.

  2. the list of files is "flat" (no treeview type display is needed)

  3. there's a need to move, or copy, one or more files from an original "complete" list to another "partial list"

I'd create an interface with two ListViews in a Panel : one column per ListView wide enough to display file names : allow multi-select in both of them.

I'd either implement drag-and-drop using standard techniques, or, more likely, I'd create a set of buttons with arrows to move items back and forth between the ListViews. I might have seperate delete buttons for each ListView and require the end-user to confirm deletion depending on the application.

If "multiple copies" (more than one list entry with identical content) are allowed I would probably use some keyboard options to control this, particularly if I were drag/dropping.

Depending on the application, I'd think about letting the end-user make "snapshots" of the current state of the two ListViews, which could then be "restored" : while a simple "Cancel" button could take care of the case where you want to reset the whole thing.


Need Your Help

Hijack response before sent to client

node.js express

I have follow codes to be used as middlewares

Indexing k-d tree?

mysql kdtree

I need to index a k-d tree, and be able to match part of it later.