unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
function SmallTOBig(small:Double):string;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public end;var
Form1: TForm1;
samll:Double;
implementation{$R *.dfm}function SmallTOBig(small:Double):string;
begin
SmallTOBig:=floattostr(samll);
end;
procedure TForm1.Button1Click(Sender: TObject);begin
Label1.Caption:=SmallTOBig(strtofloat(Edit1.Text));
end;end.
以下是出错信息:
[Error] Unit1.pas(36): Undeclared identifier: 'samll'
[Error] Unit1.pas(14): Unsatisfied forward or external declaration: 'TForm1.SmallTOBig'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
function SmallTOBig(small:Double):string;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public end;var
Form1: TForm1;
samll:Double;
implementation{$R *.dfm}function SmallTOBig(small:Double):string;
begin
SmallTOBig:=floattostr(samll);
end;
procedure TForm1.Button1Click(Sender: TObject);begin
Label1.Caption:=SmallTOBig(strtofloat(Edit1.Text));
end;end.
以下是出错信息:
[Error] Unit1.pas(36): Undeclared identifier: 'samll'
[Error] Unit1.pas(14): Unsatisfied forward or external declaration: 'TForm1.SmallTOBig'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
解决方案 »
- 对串口的操作封装成DLL
- 获得一个变量的指针,也取到这个变量的值了,怎么改变这个变量的值?
- ShellExecute(0,'print',filename,nil, nil,0);
- dbf文件转入oracle后,中文字段变成乱码,怎样解决?在线等.
- 大家好,我用Wise制作安装程序时遇到一些问题,请大家进来看看,谢谢!
- RaveReport报表高手请进,怎样才能在程序内设置自定义的纸张的大小?急
- 如何通过winsock把一个包含动态数组的记录从一方发送到另一方
- 怎样通过lable等控件来拖动无标题条的窗口?
- 如何将dll中的form引出并放置在主窗体上
- TButton要做一个快捷键如Ctrl+A怎么做?如果在Caption中&A,则只能用Alt+A,但我想用Ctrl!
- 关于windows消息处理的难题
- ★挑战CSDN高手★DELPHI中的线程使用!
改为:
function TForm1。SmallTOBig(small:Double):string;
试试
改为:
function TForm1.SmallTOBig(small:Double):string;
试试
begin
SmallTOBig:=floattostr(samll);
end;
function SmallTOBig(small:Double):string;
然后改函数体:function TForm1.SmallTOBig(small:Double):string;
begin
SmallTOBig:=floattostr(samll);
end;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
function SmallTOBig(small:Double):string;//此行去掉
可改为
function SmallTOBig(aa:Double):string;
begin
SmallTOBig:=floattostr(aa);
end;function SmallTOBig(small:Double):string;//此行去掉
运行没问题