I am using the Drive listbox, dir listbox and file listbox. Once I have
selected the drive and Dir, I want to automatically select all of the files
in the file listbox with code.
All help appreciated.
Thanks
Ken
MikeD - 26 Jul 2005 02:31 GMT
>I am using the Drive listbox, dir listbox and file listbox. Once I have
>selected the drive and Dir, I want to automatically select all of the files
>in the file listbox with code.
>
> All help appreciated.
What have you tried? If you haven't tried, you should always do so first.
If you encounter problems, than ask for help regarding that problem. It's
to YOUR advantage to always try first because that's how you learn. If
you're always just given the code, you won't learn nearly as much. With
that said, I'll give you the code against my better judgement. Make sure the
FileListBox's MultiSelect property is set at design-time to either 1 or 2.
Private Sub Dir1_Change()
Dim Index As Long
File1.Path = Dir1.Path
For Index = 0 To File1.ListCount - 1
File1.Selected(Index) = True
Next
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Signature
Mike
Microsoft MVP Visual Basic
Ken Macksey - 26 Jul 2005 15:11 GMT
Thanks for the help. It has been a long time since I used the drive, dir and
file list boxes since I am working mostly with excel and vba now and they
are not available there.
I had tried to use
Dim Index As Long
File1.Path = Dir1.Path
For Index = 0 To File1.ListCount - 1
File1.list(Index).selected = True
' and File1.listIndex(Index).selected = True
Next
End Sub
and since my help files are screwed up, I couldn't get help on the
syntax.Will have to reinstall and get them fixed.
Thanks again for the help.
Ken