Board index » delphi » Drive Combo box problem...

Drive Combo box problem...

Hi,

how can I catch the EInOutError exception of a DriveComboBox? Thanks.

Chris

 

Re:Drive Combo box problem...


"student" <sokon...@yahoo.com> skrev i en meddelelse
news:990875307.304122@nntp.up.ac.za...

Quote
> how can I catch the EInOutError exception of a DriveComboBox? Thanks.

The error only comes if you do something with the selected drive, such
as setting the DirList property to DirectoryListBox.
So don't do that.

Handle it yourself:

procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
  if DirectoryExists(DriveComboBox1.Drive+':\') then
    DirectoryListBox1.Drive := DriveComboBox1.Drive
  else
    { reset DriveComboBox1.Drive to something if you want }
end;

Finn Tolderlund

Other Threads