CodeItBetter Programming Another VB Programming Blog

How to Synchronize Drive, Dir And File List Boxes

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'File/Folder Handling - How to Synchronize Drive, Dir And File List Boxes

Option Explicit
 
'Add Drive List Box, Dir List Box and File List Box to your Form and add the following code:

Dim DriveTemp As Integer
Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End Sub
 
Private Sub Drive1_Change()
    On Error GoTo Drive1_Change_Error
    Dir1.Path = Drive1.Drive
    DriveTemp = Drive1.ListIndex
    On Error GoTo 0
    Exit Sub
Drive1_Change_Error:
    Drive1.ListIndex = DriveTemp
End Sub
 
Private Sub Form_Load()
    DriveTemp = Drive1.ListIndex
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.