Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 04-06-2017, 08:55 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,055
Default

Try to get the drive type and remove CD drive from the list. To get the drives types see the below link:

http://www.swissdelphicenter.ch/en/showcode.php?id=92
__________________
Regards,
Abdulaziz Jasser
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:52 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.