Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FileListBox

Posted on 2000-03-05
3
Medium Priority
?
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2584763
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
ID: 2584952
?
0
 

Accepted Solution

by:
sartoris earned 200 total points
ID: 2584992
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

670 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