views:

334

answers:

3

I have a WinForms application with an OpenFileDialog in it and I'd like to enable selection of multiple files when the user interacts with the dialog. How can I accomplish this?

+2  A: 

Don't know what you did, but when I click File/Open in Visual Studio 2008, it is possible to multi-select all files or just a part of them by clicking on the first file in the list, holding the shift key and then clicking on the last file.

EDIT: ok, you edited the question, seems that I misunderstood you in the first place. Idan K's answer should be correct.

Doc Brown
no not in visual studio IDE please:) its coding, i been using winforms, when i click on fileopen, in my application, a file browser pops up, but i can select only one file, what is logic/code to select multiple images? i can't do control-a, then open, one file opens and copies into buffer?
abhilashm86
+3  A: 

See the OpenFileDialog::Multiselect property, from the docs:

Gets or sets a value indicating whether the dialog box allows multiple files to be selected.

To get the list of files selected you should use the OpenFileDialog::FileNames property.

Idan K
+1  A: 

adding the style OFN_ALLOWMULTISELECT will add this see this

If you want to select a folder you should use something else :)

If you are using c++ .net (you didn't state that). You can use the MultiSelect property MSDN

PoweRoy
read the comments made by the author, he's using WinForms.
Idan K