Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Interface and Graphics

Post new topic   Reply to topic
How do I add a list of files to a listbox?
View previous topic :: View next topic  
Author Message
Tony Walker
Newbie


Joined: 18 Mar 2005
Posts: 17

PostPosted: Mar 18th, 2005 08:44 PM    Post subject: How do I add a list of files to a listbox? Reply with quote

I want to add a list of files from a sepcific folder in a listbox. How do I do that?
Back to top
View user's profile Send private message Send e-mail
TriSight
Regular


Joined: 12 Oct 2004
Posts: 69
Location: Mobile, AL

PostPosted: Mar 21st, 2005 08:52 AM    Post subject: Reply with quote

Here ya go, try this:

[vb]
Private Sub subAdd_Files(strDirectory as String, lstFileNames as Listbox)
Dim strFileName as String

If Right(strDirectory, 1) <> "\" Then strDirectory = strDirectory & "\"
strFileName = Dir(strDirectory & "*.*")
While strFileName <> ""
If Trim(strFileName) <> "." and Trim(strFileName) <> ".." Then
lstFileNames.AddItem strFileName
End If

strFileName = Dir
WEnd
End Sub
[/vb]
_________________
/=--_The Nomad_--=\
"Men of lofty genius when they are doing the least work are most active. " - Leonardo da Vinci
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Interface and Graphics All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic