Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / July 2005



Tip: Looking for answers? Try searching our database.

how do I select all items in a file list with code?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Macksey - 26 Jul 2005 00:52 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.

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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.