I want a way to list files in a directory and putting a check box beside each one of them so I can select some of them and perform operations with each selected file, what's the best way to do this?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can use checked list box control which is built-in winforms control (see links below):
http://www.functionx.com/vcsharp/controls/checkedlistbox1.htm
http://msdn.microsoft.com/en-us/library/3ss05xx6.aspx
You can also use the OpenFileDialog class. This will display the standard windows open file dialog and you can set it to allow selection of multiple files.
In many cases using a standard dialog can be easier for the user than using your custom user interface.
Try something like this:
Or you can add the dialog in the forms designer and set its properties there.
The
CheckedListBox
control would be a good start :)Drop a CheckedListBox control onto the form, then populate the contents using the DirectoryInfo and FileSystemInfo classes, like this:
Check out FileView Control It can show files/folders with check boxes.