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

Related posts:

  1. How to put Drives, Directories And Files In One List Box
  2. How to Retrieve the File Name from a Path
  3. How to Open a File and return the File Number
  4. How to load a text file into list box for a given file name
  5. How to Close a File for a given File Number
  6. How to enable the user to drag and drop items between two list boxes
  7. How to List the all file names of a Zip file
  8. How to Drag/Move items from one List Box to another List Box
  9. How to move multiple items from one List Box to another List Box/Combo Box
  10. How to use Dir$ function to get filenames and display in a list box or something.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.