delphi编译出错的问题!
下面的是整个的代码,function的位置也不知道放错没。unitUnit1;interfaceusesWindows,Messages,SysUtils,Variant...
下面的是整个的代码,function的位置也不知道放错没。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function he(a :integer;b:integer):integer;
begin
he := a * b;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit3.Text:= inttostr(he(strtoint(edit1.text),strtoint(edit2.text)))
end;
end.
[Error] Unit1.pas(31): Undeclared identifier: 'edit3'
[Error] Unit1.pas(31): Undeclared identifier: 'edit1'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
错误该怎么改呢? 应该是挺简单的,我是新手。 展开
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function he(a :integer;b:integer):integer;
begin
he := a * b;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit3.Text:= inttostr(he(strtoint(edit1.text),strtoint(edit2.text)))
end;
end.
[Error] Unit1.pas(31): Undeclared identifier: 'edit3'
[Error] Unit1.pas(31): Undeclared identifier: 'edit1'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
错误该怎么改呢? 应该是挺简单的,我是新手。 展开
展开全部
没有声明
'edit1'
'edit3'
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function he(a :integer;b:integer):integer;
end;
//加上
end;
//加上
function TForm1.he(a :integer;b:integer):integer;
begin
he := a * b;
'edit1'
'edit3'
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function he(a :integer;b:integer):integer;
end;
//加上
end;
//加上
function TForm1.he(a :integer;b:integer):integer;
begin
he := a * b;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询