Solved

FileListBox

Posted on 2000-03-05
3
266 Views
Last Modified: 2010-05-02
Can someone tell me how can I make a command button that when you click it a text box or a label will show the current files of a FileListBox... I know why don't I just place a FileListBox...because I don't want to...
Please tell me how to do this.
0
Comment
Question by:aBsOlUt
3 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
You can use this code (you need a reference to the Microsoft Scripting runtime):

Private Sub Command1_Click()
Dim objFile As File
Dim objFiles As Files
Dim objFolder As Folder
Dim objFSO As FileSystemObject

    Set objFSO = New FileSystemObject
    Set objFolder = objFSO.GetFolder(App.Path)
    Set objFiles = objFolder.Files
    For Each objFile In objFiles
        Text1.Text = Text1.Text + objFile.Name & vbCrLf
    Next
End Sub
0
 
LVL 1

Expert Comment

by:vbyuval
Comment Utility
?
0
 

Accepted Solution

by:
sartoris earned 50 total points
Comment Utility
Private Sub Command1_Click()
    Dim intFileCount As Integer
    For intFileCount = 0 To File1.ListCount - 1
        File1.ListIndex = intFileCount
        Label1.Caption = Label1.Caption & File1.FileName & vbCrLf
    Next
End Sub
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now