我做了3个Form现在在每个Form中都可能调用一个SendDate的函数,于是我想把SendDate这个函数放到公共的Unit2中放置完毕,那么如何从其他Form中调用这个SendDate函数呢??是不是要引入Unit2什么的语法,请各位给我指点指点??
解决方案 »
- 单元之间数据调用
- 救命啊!delphi串口通讯,方面的问题
- 动态创建控件后要这样!!!该怎么布局???????
- DELPHI7中如何开发CORBA应用?
- 急急急!在急等,为什么我在本机上可以运行的delphi程序exe文件,在别的机器上就是不能运行???
- 在线等,关于线程内动态创造Session,Database,Storedproc的问题,程序能在正常情况下执行,但是很好地处理网络断线的问题?
- 厦门培训好去处在哪?
- 我想做安装程序,不会装载配置文件(BDE和三层ADO连接、SQL Server数据库后台)请大家帮忙!
- 两个小问题
- 在Timer中,要实现按下某按纽,应该怎么做?
- 字符串的问题?
- 难道是“动态数组空间分配”出现错误?请指教
总是错误提示:
[Error]Unit1.pas(56):Undeclared identifier:'sendDate'
[Fatal Error]Project1.dpr(7):Could not compile used unit 'Unit1.pas'---------------
我得SendDate函数是这样的
function SendDate(a:string; b: string): string;
begin
Result:=IntToStr(StrToInt(a)*StrToInt(b));
SendDate:=Result;
end;
begin
Result:=IntToStr(StrToInt(a)*StrToInt(b));
SendDate:=Result;
end;怎么你有个公共变量名字也叫 SendDate? 命名好一点 这样容易混淆。。公共的函数可以放到一个unit去 注意 只是unit没有dfm..的。。
unit2.sendDate();
应该不会出错了
function SendDate(a:string; b: string): string;在其他单元中uses unit2
Form1: TForm1;function SendDate(a:string; b: string): string;
implementation{$R *.dfm}
function SendDate(a:string; b: string): string;
begin
Result:=IntToStr(StrToInt(a)*StrToInt(b));
SendDate:=Result;
end;