procedure Form1.SetDirectory(Path:String); begin if DirectoryExists(Path) then FileListBox1.Directory := Path; else Form2.Show; end;