OpenFileDialog (1 Viewer)

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
Hey all. I am working on an MP3 player and am having the following problem when i am importing music from a directory.

What i am wanting to do is show a openfiledialog box and let the user select which tracks to add to the mp3 player.

Now i have a folder of mp3s with over 1133 mp3 files in them. When i highlight 1133 files and click the OK button in the openfiledialog i get the following message after a couple of seconds "File doesn't exists". Now i get this message for all files after the first file that doesn't exists.

I can rerun the procedure and just add the files that it said didn't exists the first time and it runs fine.

Its like there is a file limit or something and i cant figure it out.

Code:
With OpenFileDialog1
            .Filter = "MP3 Files|*.mp3"
            .Title = "Please select an MP3 file to open"
            .Multiselect = True

            .ShowDialog()
        End With

  MessageBox.Show(OpenFileDialog1.FileNames.Length.ToString)

        'Get the MP3 tag information from track
        Dim TrackFileNames() As String = OpenFileDialog1.FileNames
        OpenFileDialog1 = Nothing

        Dim TrackFileName As String
        For Each TrackFileName In TrackFileNames
            ReadTag(TrackFileName)
        Next

        'Update database

As always thanks a bunch
 

Kodo

"The Shoe"
Local time
Today, 01:51
Joined
Jan 20, 2004
Messages
707
hard to say without seeing what readtag does, but in this view, we aren't seeing any file exists checking.. are you doing any checks on this? have you debugged and stepped through to make sure that the full path is going to the function ok?
 

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
I have tried it with file exists checking and it still fails at the exact same file before the readtag procedure runs. Its like there is a file limit or something.

very strange.

Any ideas.
 

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
OK i have a couple of folders with a bunch of mp3s. The first folder contains. 1133 files and i get the file doesn't exists at the 928th file

The next folder has 2000 files and i get the file doesn't exists at the 973rd file.

I cant figure this out and it is driving me mad. Why would it only find some of the files. Now on the first folder with 1133 files i can import the first 927 file and it work perfect. I can then add the remainder files without a problem. It just will not let me add them all at once.

Hooks
 

Kodo

"The Shoe"
Local time
Today, 01:51
Joined
Jan 20, 2004
Messages
707
I bet it has to do with the collection size in bytes. You might have to limit the selection to like 300 at a time until a solution can be found.
 

Surjer

Registered User.
Local time
Today, 06:51
Joined
Sep 17, 2001
Messages
232
what line of code throws the exception?
 

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
Im at work at the moment. Give me about 10 hours and ill give you more details.
 

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
Surjer said:
ok time is up! lol
LOL

Here is more details
Code:
  With Me.OpenFileDialog1
            .Multiselect = True
            .CheckFileExists = True
            .Filter = "MP3 Files|*.mp3"
            .Title = "Please select MP3 to add to playlist"
   End With

        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            Dim files() As String = Me.OpenFileDialog1.FileNames

            For Each file As String In files ' using the new 1.1 syntax
                ReadTag(file)
            Next
        End If

Im getting the file doesn't exist in the If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then line of code. I can get it to go past this line if i turn off the checkfileexist = false but my code still fails on the exact same file even though the file is there.

Im able to add about 900 tracks which equals about 4 gig. It seems like there is a file size limit or something. Anything past this number and i get the file doesn't exist error.

What i have done for a quick and dirty solution is use a FolderBrowserDialog so that the user can add all tracks in a folder no matter how many tracks are in that folder. I don't like this solution though.

Anyone have any ideas on how to do this without using a folderbrowserdialog.

As always thanks a bunch

Hooks
 
Last edited:

Surjer

Registered User.
Local time
Today, 06:51
Joined
Sep 17, 2001
Messages
232
Can you add a watch to the variable "FileNames" and check its contents after selecting all your files? - Maybe you can see if the control is returning bad data. I would switch to API instead of ActiveX anyways...
 

hooks

Registered User.
Local time
Yesterday, 22:51
Joined
Aug 13, 2004
Messages
160
Surjer said:
Can you add a watch to the variable "FileNames" and check its contents after selecting all your files? - Maybe you can see if the control is returning bad data. I would switch to API instead of ActiveX anyways...

It doesn't make it to the filenames variable. It fails when i do showdialog.
Actually it doesn't fail but it gives me the file doesn't exists message.

Can you give me an example of opening a file dialog using API???

Thanks
both of ya.
 

Users who are viewing this thread

Top Bottom