为什么此代码不起作用:
procedure TFormNotification.Button3Click(Sender: TObject);
begin
FormB.Show;
end;
我收到未声明的标识符错误。
最佳答案
您可能在名为 UnitB
的单元的 interface
部分中声明了一个名为 FormB
的全局变量。但 UnitA
对该单元或其内容一无所知。特别是,它不知道 FormB
一词的含义 - 该标识符未声明。
要告诉 UnitA
有关 UnitB
中声明的内容,请将 UnitB
添加到 uses 子句>单元A
:
uses Windows, SysUtils, Forms, Classes, UnitB;
关于delphi - 当我尝试从表单 A 显示表单 B 时,为什么编译器会显示 "undeclared identifier"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4404206/