|
-
Nov 23rd, 2010, 08:16 PM
#1
Thread Starter
PowerPoster
[RESOLVED] Loading wav file names to listbox
Hi there, I have a listbox called storedfilenames. What I would like to do is that in the folder where my project is, is that on the form load event I would like all of the wav files to have their filenames (not their pathways and filenames), loadeed into the listbox. I would like just the wav files loaded. Can anyone help? thanks!
-
Nov 23rd, 2010, 08:29 PM
#2
Re: Loading wav file names to listbox
Use Dir() looking for .wav extension and couple that with InstrRev() looking for the last backslash to isolate the file name by itself. Do you need code?
-
Nov 23rd, 2010, 08:30 PM
#3
Thread Starter
PowerPoster
Re: Loading wav file names to listbox
-
Nov 23rd, 2010, 09:07 PM
#4
Re: Loading wav file names to listbox
You can do it without InStrRev(). Build a form with a command button and a list box. Then apply this code:
Code:
Private Sub Command1_Click()
Dim NameFile As String, SubDir As String
SubDir = CurDir$ & "\*.wav*" ' Change CurDir to whatever directory is being searched
NameFile = Dir$(SubDir)
Do While NameFile <> vbNullString
List1.AddItem NameFile
NameFile = Dir$
Loop
End Sub
-
Nov 24th, 2010, 12:50 AM
#5
Thread Starter
PowerPoster
Re: Loading wav file names to listbox
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|