Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Thread Tools Display Modes
Old 03-19-2017, 01:06 PM
larshgf larshgf is offline
Senior Member
Join Date: Jan 2001
Posts: 236
Default Change Drive in code


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

DirectoryListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Drive := DriveComboBox1.Drive;
FileListBox1.Directory := DirectoryListBox1.Directory;
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

Any suggestions?
Reply With Quote
Old 04-06-2017, 08:55 AM
Jasser Jasser is offline
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,058

Try to get the drive type and remove CD drive from the list. To get the drives types see the below link:
Abdulaziz Jasser
Reply With Quote

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 01:41 AM.

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