unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
procedure Timer1Timer(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
begin
timeamstring:='上午';
timepmstring:='下午';
if radiobutton1.checked then
labe1.Caption:=formatdatetime('ampmhh:nn:ss',time)
else
labe1.Caption:=formatdatetime('hh:nn:ss',time);end;procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Timer1Timer(Sender);
end;procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Timer1Timer(Sender);
end;end.
----------------------------------------------------------------------------------------------------------------
上面是那个程序,可是运行时缺有错误:
错误提示是:
[Error] Unit1.pas(37): Undeclared identifier: 'labe1'
[Error] Unit1.pas(39): Missing operator or semicolon
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
----------------------------------------------------------------------------------------------------------------
我定义了那个label了呀,可为什么还有提示????
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
procedure Timer1Timer(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
begin
timeamstring:='上午';
timepmstring:='下午';
if radiobutton1.checked then
labe1.Caption:=formatdatetime('ampmhh:nn:ss',time)
else
labe1.Caption:=formatdatetime('hh:nn:ss',time);end;procedure TForm1.RadioButton1Click(Sender: TObject);
begin
Timer1Timer(Sender);
end;procedure TForm1.RadioButton2Click(Sender: TObject);
begin
Timer1Timer(Sender);
end;end.
----------------------------------------------------------------------------------------------------------------
上面是那个程序,可是运行时缺有错误:
错误提示是:
[Error] Unit1.pas(37): Undeclared identifier: 'labe1'
[Error] Unit1.pas(39): Missing operator or semicolon
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
----------------------------------------------------------------------------------------------------------------
我定义了那个label了呀,可为什么还有提示????
if radiobutton1.checked then
labe1.Caption:=formatdatetime('ampmhh:nn:ss',time)
else
labe1.Caption:=formatdatetime('hh:nn:ss',time); labe1拼写错误了
在界面上删除了.从新添加下.