Juno Posted August 1, 2003 Posted August 1, 2003 Hi folks! Great Forum, good point that it is manged in sections for each kind of issue. My problem: I use openFileDialog in C# with multiselect=true; if the user takes about 600 files of a directory, the runtime will give him the following message: "Too many files selected" ot that like (I translate this from German language) What can I do to avoid this? Thnak you for everyone that will answer me Quote
*Experts* Bucky Posted August 1, 2003 *Experts* Posted August 1, 2003 I've never heard of having that problem before. The best bet would be to pop a message box to the user informing them that they selected too many files, and also telling them to select less next time. Then re-open the dialog box so they can try again. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Juno Posted August 1, 2003 Author Posted August 1, 2003 But this I don't want to do, because I've written a tool for work with big collections of files. (recognize files with differnt names, renaming them, and so on) Quote
Leaders dynamic_sysop Posted August 1, 2003 Leaders Posted August 1, 2003 why not specify a limit if it's causing a problem? here's a little example i made for you , not sure if it helps but it may : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim od As New OpenFileDialog() With od .Multiselect = True .Filter = "Text(*.txt)|*.txt" .InitialDirectory = "C:\" If .ShowDialog = DialogResult.OK Then If .FileNames.Length > 10 Then '/// max limit goes here. MessageBox.Show("To many files chosen!") Else .OpenFile() End If End If End With End Sub Quote
*Experts* Bucky Posted August 1, 2003 *Experts* Posted August 1, 2003 You could require that the files all be placed in the same directory, and use the Browse for Folder dialog class from EliteVB to select that foder. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Juno Posted August 6, 2003 Author Posted August 6, 2003 but I must work with 500 files! thank you for answering me. But I really do want to work with hundreds of files in one directory. I'm writing a tool to rename serials of files in directorys. So it is important for me, that I can handle big quantities of files. For Example, the user wants to rename all files in a drirectory but one; so, he will first select all files (Ctrl+A) and then he will de-select thos ones that he doens't want to process. That's an ordinary scene, I think. So, I don't want to send error-messages, I really want to work with hundreds of files in one selection. Quote
*Experts* Bucky Posted August 6, 2003 *Experts* Posted August 6, 2003 Well you're clearly not going to able to reach your goal with the OpenFileDialog control (Hey, that rhymes!). If you have VB6, you could create an ActiveX control that uses the FileListBox, DriveListBox, and DirListBox to select your files. Or you could just create your own form in C# that populates listboxes with directories and files using classes found in the System.IO napespace. Other than that, I don't know what to say. If you can find or create an alternate open file dialog that doesn't rely on the Windows Common Dialog control, then all the more power to you. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.