View Single Post
 
Old 03-19-2017, 01:06 PM
larshgf larshgf is offline
Senior Member
 
Join Date: Jan 2001
Posts: 234
Default Change Drive in code

Hi,

Do you know how to change drive in code?
I use TDriveComboBox and want to avoid that my program stops if a user choose the D-drive if it does not include any CD. I have tried with this code

begin
try
DirectoryListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Directory := DirectoryListBox1.Directory;
except
on EInOutError do begin
messagedlg('the choosen drive is not ready', mtwarning, [mbok], 0);
here I would like to place code that change my drive to C
end;
end;

Any suggestions?
Reply With Quote