Guest_imported
New member
- Jan 1, 1970
- 0
Why this code doesn't work?
Debugger:
[Error] Unit1.pas(29): Undeclared identifier: 'Label1'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure MyProcedure;
begin
Label1.Caption := 'Hello!';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyProcedure;
end;
end.
Debugger:
[Error] Unit1.pas(29): Undeclared identifier: 'Label1'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure MyProcedure;
begin
Label1.Caption := 'Hello!';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyProcedure;
end;
end.