Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

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)

  • Leaders
Posted

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

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

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.

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...