标题:写成函数,就找不到控件了
取消只看楼主
angel725
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-11-5
结帖率:0
 问题点数:0 回复次数:0 
写成函数,就找不到控件了

unit GG;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, ExtCtrls, StdCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Timer1: TTimer;
IdHTTP1: TIdHTTP;
procedure Timer1Timer(Sender: TObject);

private
{ Private declarations }

public
{ Public declarations }
end;

var
Form1: TForm1;

implementation


{$R *.dfm}
function zhonghang():string;
begin

with TStringList.Create do try
Text := IdHTTP1.Get('http://www.xxx.com');
if Count > 2 then
begin
edit1.Text:= Copy(Strings[Count - 2], 0, 8);
edit2.Text:= Copy(Strings[Count - 2], 0, 8);
end;
finally
Free;
end;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
zhonghang();
end;

end.
错误:
[Error] GGold.pas(47): Undeclared identifier: 'IdHTTP1'
[Error] GGold.pas(50): Undeclared identifier: 'edit1'
[Error] GGold.pas(51): Undeclared identifier: 'edit2'


这段不对了??
找不到控件,
函数放错位置了?

搜索更多相关主题的帖子: 函数 控件 declarations TEdit uses 
2006-11-05 01:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-100808-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.238124 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved