Instead of using TOpenDialog, Delphi provides super simple function can select directory as following:
uses Vcl.FileCtrl; . . . var chosenDirectory : string; begin // Ask the user to select a required directory, starting with C: if selectdirectory('Select a directory', 'C:\', chosenDirectory) then ShowMessage('Chosen directory = '+chosenDirectory) else ShowMessage('Directory selection aborted'); end;
Above is tested on Delphi 10.2
You can see another example at Select Directory in Delphi