?
Solved

List the files and directory in a drive

Posted on 2003-03-30
6
Medium Priority
?
143 Views
Last Modified: 2010-05-03
Hi,
Can u pls help me to write the code to get the list filenames and the directory names in a drive and the results should be printed in the textbox.it should work like "dir" in dos.
Thank u
0
Comment
Question by:rtananthan
[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
6 Comments
 
LVL 4

Accepted Solution

by:
iozturk earned 100 total points
ID: 8237079
There are controls drivelistbox, dirlistbox, filelistbox. Use them. If you want the results in a text box hide them and show selected values on text box.
0
 
LVL 2

Expert Comment

by:AKbor75
ID: 8237371
see "dir" example in vb(a) help
0
 
LVL 11

Assisted Solution

by:supunr
supunr earned 100 total points
ID: 8238441
Private Sub DirListing_click()
    Dim DirectoryName As String
    Dim FileName As String
    Dim FolderName As String
   
    FolderName = "C:\"
    DirectoryName = Dir(FolderName, vbDirectory)
    Do While DirectoryName <> ""
        text1.text = text1.text & "[" & DirectoryName & "]" & vbcrlf
        DirectoryName = Dir
    Loop
    FileName = Dir(FolderName & "*.*")
    Do While FileName <> ""
        text1.text = text1.text &  FileName & vbcrlf
        FileName = Dir
    Loop
End Sub

' Good Luck!
0
 

Expert Comment

by:CleanupPing
ID: 8531287
Hi rtananthan,
This old question (QID 20568472) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 8965997
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split points between iotturk and supunr
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GrahamSkan
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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

800 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