FileName Property Example

This example displays a message in a Label control when a filename in a FileListBox control is double-clicked. To try this example, paste the code into the Declarations section of a form that contains a Label control, a DirListBox control, and a FileListBox control, and then press F5 and double-click any filename in the FileListBox control.

Private Sub Dir1_Change ()
   File1.Path = Dir1.Path   ' Set File1 path.
End Sub
Private Sub File1_PathChange ()
   Dir1.Path = File1.Path   ' Set Dir1 path.
End Sub
Private Sub File1_DblClick ()
   ' Display the selected filename when double-clicked.
   Label1.Caption = "Your selection: " +_ File1.FileName
End Sub