首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

为什么连成功后Timer1控件就不在循环了解决办法

2012-03-01 
为什么连成功后Timer1控件就不在循环了Delphi(Pascal) codeprocedure TForm1.Timer1Timer(Sender: TObject

为什么连成功后Timer1控件就不在循环了

Delphi(Pascal) code
procedure TForm1.Timer1Timer(Sender: TObject);beginIdTCPClient1.Host:=192.168.1.88;IdTCPClient1.Port:=5555;         if not IdTCPClient1.Connected then begin  try      IdTCPClient1.Connect;            IdTCPClient1.Writeln(ip_w);            StatusBar1.Panels.Items[0].Text:='连接成功!';  except      StatusBar1.Panels.Items[0].Text:='连接错误!';      exit;  end; end;end;


为什么连成功后Timer1控件就不在循环了

[解决办法]
if not IdTCPClient1.Connected then begin
你的这条语句已经跳过下面的过程了。
[解决办法]
楼上的回答正确,楼主若不相信Timer1Timer事件还在执行,可以在if not IdTCPClient1.Connected then begin语句设置断点,它一定会运行到这句停下。

热点排行