Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I am trying to use the .NET OpenFileDialog to select upto 1100 files at one time (this is a requirement!).
When a certain sequence of files are selected (approximately 150-200 files) and the OK button is hit, the application crashes with a "Too many files selected. Please select fewer files" error message.

Looking on MSDN, I have seen that OpenFileDialog has a limit of 200 files. This does not make sense as I am able to select all 1100 files without any issues.

I have also read that the buffer assigned to contain the files isn't big enough but that it isn't possible to increase the buffer size?

Does anyone know the options I have to be able to selected upto 1100 in an OpenFileDialog or maybe using a different control?
:thumbsup:

[Removed c++ tag - Rajesh]
Posted
Updated 9-Dec-10 3:56am
v2
Comments
[no name] 8-Dec-10 11:48am    
No what doesn't make sense is why you are selecting 1100 files.
Richard MacCutchan 8-Dec-10 13:18pm    
I agree with Mark, it makes no sense to use this dialog to select such a large number of files. I would suggest finding an alternative method of selecting the files that you need to process.
Kschuler 8-Dec-10 15:14pm    
Maybe you should look at using the FolderBrowserDialog to select a folder instead of the individual files, and then perform whatever processing you are doing on all files in the folder.

A good alternative could be to put all file names in a text file, and then accept that text file as your program's input.
 
Share this answer
 
v2
Comments
Member 4523525 9-Dec-10 11:02am    
Thaddeus, before I get to the point where I can add the selected filenames to a text file, the form crashes out with the "Too many files selected" exception ( openfiledialog->ShowDialog() == ::DialogResult::OK ).
I found this thread, it suggests using the windows API GetOpenFileName, which you can change the size of unlike the .NET version.

http://www.dotnet247.com/247reference/msgs/17/86277.aspx[^]
 
Share this answer
 
Comments
Member 4523525 9-Dec-10 11:02am    
ARopo, I have looked down the route of using the CommonDialog but am having trouble trying to find out how to code this. My project is written in C++ in the .NET environment using c-code DLL's. Would it be easier to use the CommonDialog class or GetOpenFileName API?
You should allow user to pick the directory. Then you list all the files and let them select as many files, there will not be any problem.

I am talking the same way as ftp clients are designed.
http://screenshots.en.softonic.com/en/scrn/40000/40069/3_fireftp1.jpg[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900