菜菜继续发问,关于子程序调用【不知道是不是这么叫】

chengran1984 2009-06-24 08:24:32
自己写一个如下的,想在其他地方调用那么该怎么做?
procedure test();

begin
showmessage('test');
end;
...全文
68 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chengran1984 2009-06-25
  • 打赏
  • 举报
回复
继续发问,
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;

procedure test();// 自己添加

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Test;
end;

//自己添加
procedure test;
begin
ADOquery1.close;--------------------------------------》ADOquery1为什么我加在这里就报错?
showmessage('test');
end;

end.

[DCC Error] Unit4.pas(59): E2003 Undeclared identifier: 'ADOquery1'
[DCC Error] Unit4.pas(59): E2029 '(' expected but ';' found
[DCC Fatal Error] 我搜服采集程序.dpr(5): F2063 Could not compile used unit 'Unit4.pas'
Storm2008 2009-06-24
  • 打赏
  • 举报
回复
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;

procedure test();// 自己添加

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Test;
end;

//自己添加
procedure test;
begin
showmessage('test');
end;

end.


窗体上加个按钮,双击按钮。
ks_reny 2009-06-24
  • 打赏
  • 举报
回复

直接用 test
chengran1984 2009-06-24
  • 打赏
  • 举报
回复
这个问题是不是太弱智了,都没人搭理我。。

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧