Possible Duplicate:
Delphi: Selecting a directory with TOpenDialog
I need to open a specific folder on my project. When I use opendialog1, I can only open a file. How about opening a folder ?
PS : I use Delphi 2010
On Vista and up you can show a more modern looking dialog using TFileOpenDialog
.
var
OpenDialog: TFileOpenDialog;
SelectedFolder: string;
.....
OpenDialog := TFileOpenDialog.Create(MainForm);
try
OpenDialog.Options := OpenDialog.Options + [fdoPickFolders];
if not OpenDialog.Execute then
Abort;
SelectedFolder := OpenDialog.FileName;
finally
OpenDialog.Free;
end;
which looks like this: