[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'FileCtrl' (#lcl)

# TCustomFileListBox.FileName

FileName - the name of the selected file.

## Declaration

Source position: filectrl.pp line 75

`public property TCustomFileListBox.FileName : string read FFileName write SetFileName;`

## Description

FileName is a String property which contains the file name for the currently selected item in the list box control. The value in FileName is updated when an item in the control is selected, or when a new value is assigned to the ItemIndex property.

Assigning a new value to the property causes the IndexOfFile method to be called to locate the specified value in the Items for the control. The private UpdateSelectedFileName method is called to ensure that the new file name includes the path information in Directory, and to signal the OnChange event handler (when assigned).

## See also

TCustomFileListBox.Directory |  | The Directory or Folder in which the file is located.
TCustomFileListBox.IndexOfFile |  | Gets the ordinal position for the specified file name in Items.
TCustomFileListBox.UpdateFileList |  | Loads the list of files and/or directories for the list box control.
TCustomFileListBox.OnChange |  | Event handler signalled when the selected file in the list box control is changed.
TCustomListBox.ItemIndex |  | Ordinal position for the currently selected item, -1 if none.
TCustomListBox.Items |  | The list of all items defined in the control.