Wednesday, 7 March 2012

The File List Box User Control

The File List Box user control combines a file list, a drive list and a directory list to display the file name in a text box.
Private Sub File1_Click()
Dim FileName As String
FileName = File1.Path
If Right$(FileName, 1) <> "\" Then FileName = FileName & "\"
FileName = FileName & File1.FileName
Text1.Text = FileName
End Sub
Private Sub Drive1_Change()
 ' The Drive property also returns the volume label, so trim it.
 Dir1.Path = Left$(Drive1.Drive, 1) & ":\"
 End Sub

 Private Sub Dir1_Change()
 File1.Path = Dir1.Path
 End Sub

No comments:

Post a Comment