469,159 Members | 1,454 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,159 developers. It's quick & easy.

Directories and Listbox

I want to be able to have someone click a command button, then have a directory form show, that part is complete. Now i need help adding all the files in this directory to a list with the extensions ".mp3, .wav, and .mid". this is what i have so far.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAddDir_Click()
  2. Dim di As New IO
  3. .DirectoryInfo ("c:\")
  4. Dim diar1 As IO
  5. .FileInfo() = di.GetFiles("*.mp3", "*.wav", "*.mid")
  6. Dim dra As IO.FileInfo
  7. For Each dra In diar1
  8.     lstSongs.Items.Add (dra)
  9. Next
  10. End Sub
any hints or tips would be appreciated

-Jacob
Aug 21 '07 #1
11 1540
Killer42
8,435 Expert 8TB
You've told us what you're doing. Can you tell us what your problem is?
Aug 21 '07 #2
You've told us what you're doing. Can you tell us what your problem is?

haha sorry about that.

i get a compile error, user-defined type not defined

is there any easier way to do what im doing?
Aug 21 '07 #3
hariharanmca
1,977 1GB
haha sorry about that.

i get a compile error, user-defined type not defined

is there any easier way to do what im doing?
user-defined type not defined

It comes missing some references. I think you didn't reffer FSO.

can you post which version?
Aug 21 '07 #4
I am working in asp.net 2.0 and using vb script.
Aug 21 '07 #5
hariharanmca
1,977 1GB
I am working in asp.net 2.0 and using vb script.
Debug and just point which piece of code throwing this error.

(I think, this error will come at build time)

Just check all reference are there
Aug 21 '07 #6
Killer42
8,435 Expert 8TB
Debug and just point which piece of code throwing this error.

(I think, this error will come at build time)

Just check all reference are there
I'm not sure VBScript has any concept of "build time" - isn't it interpreted at runtime?

But I agree, we need to know which statement/reference is throwing the error.
Aug 21 '07 #7
Dim di As New IO
is where its erroring

im not sure what you mean by version but im running VB6 32 bit
Aug 21 '07 #8
Killer42
8,435 Expert 8TB
Dim di As New IO
is where its erroring

im not sure what you mean by version but im running VB6 32 bit
I use VB6, and I'm not aware of any object type of IO. In fact I've just tested and got the same error. Either you've got the type (IO) wrong, or you need to add a reference to the library that contains it.

Also, we need to sort something out. Are you using VBScript or VB? They are quite similar, but not the same thing.
Aug 21 '07 #9
Im for sures using visual basic 6.0
Aug 21 '07 #10
Im for sures using visual basic 6.0

and i know this is off topic but does anyone know how to run the moosock2.ocx socket on vb6?
Aug 22 '07 #11
Killer42
8,435 Expert 8TB
and i know this is off topic but does anyone know how to run the moosock2.ocx socket on vb6?
Well I've never heard of it.

I'd suggest you open a new discussion for this. A lot of people won't be bothering to read this one, either because the title doesn't interest them, or because the number of replies indicates it is already being dealt with.
Aug 22 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

17 posts views Thread by amber | last post: by
3 posts views Thread by Paul T. Rong | last post: by
6 posts views Thread by Chris Leuty | last post: by
7 posts views Thread by Dave | last post: by
3 posts views Thread by Ali Chambers | last post: by
2 posts views Thread by JIM.H. | last post: by
4 posts views Thread by rn5a | last post: by
3 posts views Thread by rn5a | last post: by
1 post views Thread by rn5a | last post: by
6 posts views Thread by =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.