Vcl.Dialogs.TOpenDialog.FileName

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property FileName: TFileName read GetFileName write SetFileName;

C++

__property System::Sysutils::TFileName FileName = {read=GetFileName, write=SetFileName};

Properties

Type Visibility Source Unit Parent
property published
Vcl.Dialogs.pas
Vcl.Dialogs.hpp
Vcl.Dialogs TOpenDialog

Description

Indicates the name and directory path of the last file selected.

The FileName property returns the name and complete directory path of the most recently selected file. The value of FileName is the same as the first item in the Files property.

To make a file name appear by default in the dialog's edit box, assign a value to FileName in the Object Inspector or in program code. Programmatic changes to FileName have no effect while the dialog is active.

if OpenDialog1.Execute then
  Memo1.Lines.LoadFromFile(OpenDialog1.FileName)
else
  Memo1.Lines.Clear;
if (OpenDialog1->Execute())
  Memo1->Lines->LoadFromFile(OpenDialog1->FileName);
else
  Memo1->Clear();

See Also

Code Examples