Here is my unicode class. In my example fill a RTB with all folders from C.
Class do some nice things and is extracted from M2000 Interpreter (the I use it to fill a user control, a special list box that can be show folders and files in a form of tree).
In a form only these lines are enough to get all folders along the path. Because list can hold files too, we have to use mid$() to skip the folder marker. So if you make NoFiles as False you get the files too.
Code:Dim md As New recDir Private Sub Form_Load() Dim a$, i As Long, k As Long RichTextBox1 = "" md.Nofiles = True a$ = md.Dir2("C:\", , True) Me.Caption = md.listcount k = 1 For i = 1 To md.listcount RichTextBox1.SelStart = k a$ = Trim$(Str$(i)) + " " + Mid$(md.List(i), 2) + vbCrLf k = k + Len(a$) RichTextBox1.SelText = a$ Next i End Sub
folders.zip




Reply With Quote
