Why does the compiler say “undeclared identifier” when I try to show form B from form A?

Why this code does not work:

procedure TFormNotification.Button3Click(Sender: TObject);
begin
  FormB.Show;
end;

I get an Undeeclared identifier error.

+3
source share
2 answers

You probably have a global variable named named FormBin the interfacedepartment section named UnitB. But UnitAhe knows nothing about this device or its contents. In particular, he does not know what the word means FormB- this identifier is not declared.

To report UnitAthings declared in UnitB, add the UnitBuses clause to UnitA:

uses Windows, SysUtils, Forms, Classes, UnitB;
+10
source

, FormB .

+5

Source: https://habr.com/ru/post/1779502/


All Articles