Badr
Badr

Reputation: 10648

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?

Upvotes: 4

Views: 6580

Answers (5)

Adrian Fâciu
Adrian Fâciu

Reputation: 12552

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.

Upvotes: 2

BillW
BillW

Reputation: 3435

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.

Upvotes: 0

logicnp
logicnp

Reputation: 5836

Consider using the FolderView and FileView controls from Shell MegaPack.

Upvotes: 0

tyranid
tyranid

Reputation: 13318

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.

Upvotes: 1

Rajagopalk
Rajagopalk

Reputation: 31

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

Upvotes: 0

Related Questions