请问在哪里定义全局变量和函数、过程?要整个工程都可以引用。
定义完后,函数、工程体在哪里写?变量值在哪里赋?
给个小程序最好
定义完后,函数、工程体在哪里写?变量值在哪里赋?
给个小程序最好
解决方案 »
- 如何用鼠标拖动dbgrid中的记录,并更改数据集的顺序
- 为什么不能播放RMVB格式的文件?
- 求以下概率
- 高手请进:如何获得外部程序的菜单项内容?(UP有分)
- 一个1~2周可以完成的兼职项目,有兴趣的和我联系,请将您使用DELPHI的水平大致说一下.
- 帮我看一下下面这段程序!!!!
- 我能用erwin 产生access的数据库马,我试了几次总是不成功,产生的语法不是基本的SQL语法的。
- 请大家帮忙,很急想解决它,thanks!!!
- 那有delphi6.0下载?(
- 100分 請教:Delphi7+Oracle10,ADO連接,C/S架構,如何獲取用戶連接數據庫session?多謝!
- 如何在系统中注册一个Service Application程序?(在线)
- 请问如何用代码配置BDE?(数据库是sql server)
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;implementationuses Unit2; //引用unit2{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
GetSystemVersion;
end;end.
第二个:unit Unit2;interfaceuses
Dialogs;const
SystemVersion = '1.0'; //(全局变量) //得到系统版本 (全局函数)
procedure GetSystemVersion;
implementationprocedure GetSystemVersion;
begin
Showmessage(SystemVersion);
end;end.
顺便作广告:(请求帮助)
http://expert.csdn.net/Expert/topic/2440/2440285.xml?temp=.5369837
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;type
TForm1 = class(TForm)
ADOQuery1: TADOQuery;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Globle_str:string;//全局变量
function GetSysdate:TdateTime; // 全局函数
end;var
Form1: TForm1;
implementation{$R *.dfm}
function TForm1.GetSysdate :tdatetime;
begin
adoquery1.Close;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select sysdate from dual');
adoquery1.Open ;
result:=adoquery1.fieldbyname('sysdate').AsDateTime ;
end;
在public中定义时候,必须全局变量在全局函数或过程前.
在其它form应用时候,必须form1.Getsystem