能不能关掉does not have a corresponding component报警提示?

hiloves 2009-10-26 04:47:17
在主窗体中写了一个自定义类,不是VCL控件,结果每次保存或编译都会出现does not have a corresponding component报警提示,但程序能正常运行,这个提示很烦,而且点确定,还会自动把你定义的类删掉。

TMyForm = class(TForm)
private
MyClass : TMyClass;自己定义的类,不是VCL组件类。
...全文
790 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hiloves 2009-10-28
  • 打赏
  • 举报
回复
这确实是一种方法。
huangheguyun 2009-10-28
  • 打赏
  • 举报
回复
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;

{自定义的 TMyList 类}
TMyList = class(TObject)

end;


var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
myList: TMyList; {声明一个 TMyList 类的变量}
begin
myList := TMyList.Create;
ShowMessage(myList.ClassName); {TMyList}
myList.Free;
end;

end.


hiloves 2009-10-27
  • 打赏
  • 举报
回复
沉底了
hiloves 2009-10-26
  • 打赏
  • 举报
回复
当然要引用了TMyClass所在的单元,楼上的,如果不引用单元出现的错误是,Undeclared identifier,并且无法编译更不要说正常运行了,这和does not have a corresponding component完全不是一码事,出现这个错误是因为该类不是标准VCL控件,该类不能放到主窗体中。
wooden954 2009-10-26
  • 打赏
  • 举报
回复
你的类TMyClass是在哪个单元中定义的,引用这个单元了没有?如果没有引用单元,很容易发生类似的错误。
支持中文哦 2009-10-26
  • 打赏
  • 举报
回复
我只知道如果TFrame的定义如果删除某个组件,然后直接操作TFrame某个实例,就会有这个错误
hiloves 2009-10-26
  • 打赏
  • 举报
回复
会沉的
hiloves 2009-10-26
  • 打赏
  • 举报
回复
要沉了

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧