Link to home
Start Free TrialLog in
Avatar of leotron
leotron

asked on

VB6 Display directory content into a list box

I know this is a simple one, but I for some reason can not get through it. I am trying to list the contents of a directory in VB6. I am trying to list it on a list box in checkbox mode so that I can later delete any files that are check can some one help me with this. Thank you.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

what contents? the files, the directories?
are you aware that VB comes with a filelistbox control, where all you need to do is put the path and the filter in.

instead of the checkbox, use the multiselect open.
Avatar of leotron
leotron

ASKER

The thing is that I am simply tring to make it as simple as possible for my end users. and I think that the check box method would be easier for them. and I would like to list all files inside a particular directory.  and have the files listed in a list box so that the end user simply clicks on the check mark and that's it.
assuming your listbox is called lstFiles, and is configured to checkbox display

lstFiles.Clear

strFile = Dir("YourFolder\")
while strFile <> empty
  lstFiles.Add strFile
  strFile = Dir
wend

ASKER CERTIFIED SOLUTION
Avatar of jkaios
jkaios
Flag of Marshall Islands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial