multiple files to listbox

thingimijig
09-06-2003, 07:35 AM
how would i go about retrieving all the files (filenames) in a specified folder to a listbox.

thanks
thingimijig.

reboot
09-06-2003, 07:53 AM
You'd loop through the folder with Dir$ and .AddItem the returned filenames to the listbox.

thingimijig
09-06-2003, 08:02 AM
thank you reboot

thingimijig.

thingimijig
09-06-2003, 04:56 PM
could anybody give me an example of this, been looking but there is so many different ways and to be honest i dont understand.

i have a command button which browses just for folders.

how would i get the files(path) in the folder to a listbox using the dir$, loop thing.


thanks
thingimijig.

Ales Zigon
09-07-2003, 01:56 AM
Or, if you want to do it quick, you can use SendMessage API do do it for you. Like this:
Const DDL_READWRITE = &H0
Const LB_DIR = &H18D

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long

Dim sPattern As String

sPattern = "C:\windows\*.bmp" 'choose the extention. It can be any or just *.*

SendMessage List1.hwnd, LB_DIR, DDL_READWRITE, sPattern

thingimijig
09-07-2003, 11:02 AM
@ ales zigon

thanks for your reply, it worked great.

one more question if you dont mind.

how would you go about getting the full path into the listbox ?


thanks
thingimijig.

thingimijig
09-08-2003, 04:01 AM
anybody please!


thanks
thingimijig.

kevin_verp
09-08-2003, 05:28 AM
Perpahs you'd better use the FileListBox.

If you look at it's properties you can do everything you want,
show hidden files, show only these extensions, get paths, etc...

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum