Visual Basic - Objects - Controls - File ListBox gox.gif (837 bytes)Drive ListBox
gox.gif (837 bytes)Dir ListBox

| Properties | Methods | Events | Functions |

Prefix   fil
Default name File1
Default property FileName
    
VB 3    
VB 4
VB 5 vb5-file-listbox.gif (909 bytes) vb5-file.gif (2211 bytes)

 

File ListBox - Properties
| FileName | Path |

FileName (Default)
s = File1.FileName  's = "Cirkler.bmp"
Path
s = File1.Path  's = "C:\Windows"

 

File ListBox - Methods

 

File ListBox - Events
| Click |

Click
Private Sub File1_Click()
  p = FullPath(File1)
  Image1.Picture = LoadPicture(p)
End Sub
> Functions: FullPath
 

File ListBox - Functions
| FullPath |

FullPath
If the path is the drive-root, the full path is:
FP = File1.Path & File1.FileName
FP = "C:\" & "log.txt"
- else, the full path is:
FP = File1.Path & "\" & File1.FileName FP = "C:\Windows" & "\" & "log.txt"
 
The FullPath() function adds the "\" when missing:
Function FullPath(F As FileListBox) As String
  Dim p As String
  p = F.Path
  If Right(p, 1) <> "\" Then p = p & "\"
  FullPath = p & F.filename
End Function
Ex: > Events:  Click