mathes
asked on
problem with DriveComboBox
Hi experts,
I have a form with a DriveComboBox in my program. This ComboBox displays all drives on my PC (harddisk,floppy drive,cd-rom drive,
JAZ-drive)
If I try to select a file from the harddisk, everthing works perfectly. However if I try to select a file from
floppy disk/CD-ROM/JAZ-drive, this will cause a run-time error, if there is no medium inserted in the
floppy disk/CD-ROM/JAZ-drive.
(Delphi says: "exception of class ElnOutError. I/O error 21.
How can I work around this problem? Can you please show me a sample source code which fixes this problem?
With kind regards
Mathes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Phil,
thank you for your feedback. Can you please tell me, how I can empty
the DirList property. Whenever I tried your routine in my sample code, the
DirListbox was never empty and therefore I got a runtime error.
With kind regards
Mathes
Real easy, in the designer click the DriveCombo component, open object inspector, click the DirList property and press Delete, Enter. Now run the program!
Regards,
Phil.
Regards,
Phil.
ASKER
Thank you for your help. This is exactly what I was looking for.
With kind regards
Mathes
With kind regards
Mathes
Include an exception handler such as
procedure TForm1.DriveComboBox1Chang
begin
try
except on EINOUTError do
ShowMessage('Drive not available');
end;
end;