主题:Delphi7使用DriveComboBox出错?
[em18]在Delphi7中调用DriveComBox、 DirectoryListBox、FileListBox,程序代码如下:
unit testP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl, Menus;
type
TForm1 = class(TForm)
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
FileListBox1: TFileListBox;
procedure DriveComboBox1Change(Sender: TObject);
procedure DirectoryListBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
directorylistbox1.Drive:=drivecombobox1.Drive;
end;
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
filelistbox1.Directory:=directorylistbox1.Directory;
end;
end.
运行程序出现以下错误提示信息:
错误] testP.pas(11): Undeclared identifier: 'TDriveComboBox'
[错误] testP.pas(11): Published field 'DriveComboBox1' not a class nor interface type
[错误] testP.pas(12): Undeclared identifier: 'TDirectoryListBox'
[错误] testP.pas(12): Published field 'DirectoryListBox1' not a class nor interface type
[错误] testP.pas(13): Undeclared identifier: 'TFileListBox'
[错误] testP.pas(13): Published field 'FileListBox1' not a class nor interface type
[错误] testP.pas(32): Missing operator or semicolon
[错误] testP.pas(32): Missing operator or semicolon
[错误] testP.pas(37): Missing operator or semicolon
[错误] testP.pas(37): Missing operator or semicolon
[致命错误] dTest.dpr(5): Could not compile used unit 'testP.pas'
不知道那里出了问题?
unit testP;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl, Menus;
type
TForm1 = class(TForm)
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
FileListBox1: TFileListBox;
procedure DriveComboBox1Change(Sender: TObject);
procedure DirectoryListBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
directorylistbox1.Drive:=drivecombobox1.Drive;
end;
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
filelistbox1.Directory:=directorylistbox1.Directory;
end;
end.
运行程序出现以下错误提示信息:
错误] testP.pas(11): Undeclared identifier: 'TDriveComboBox'
[错误] testP.pas(11): Published field 'DriveComboBox1' not a class nor interface type
[错误] testP.pas(12): Undeclared identifier: 'TDirectoryListBox'
[错误] testP.pas(12): Published field 'DirectoryListBox1' not a class nor interface type
[错误] testP.pas(13): Undeclared identifier: 'TFileListBox'
[错误] testP.pas(13): Published field 'FileListBox1' not a class nor interface type
[错误] testP.pas(32): Missing operator or semicolon
[错误] testP.pas(32): Missing operator or semicolon
[错误] testP.pas(37): Missing operator or semicolon
[错误] testP.pas(37): Missing operator or semicolon
[致命错误] dTest.dpr(5): Could not compile used unit 'testP.pas'
不知道那里出了问题?