回 帖 发 新 帖 刷新版面

主题:帮忙看看为什么出错

下面代码运行时没有错误 为什么程序运行一段时间后会跳出错误

var
 remotehost:string;
begin
 remotehost:=inputbox('建立连接','请输入对方的I地址:','');
  if trim(remotehost)<>'' then
    if cs.Active then  cs.active:=true;
     cs.port:=4000;
     cs.Host:= remotehost;
     try
     cs.active :=true;
     showmessage('连接成功!');
     except
     showmessage('连接失败!');
     end;
end;

回复列表 (共2个回复)

沙发

下面代码运行时没有错误 为什么程序运行一段时间后会跳出错误

var
 remotehost:string;
begin
 remotehost:=inputbox('建立连接','请输入对方的I地址:','');
  if trim(remotehost)<>'' then
    if cs.Active then  cs.active:=true;--------这里改成False
     cs.port:=4000;
     cs.Host:= remotehost;
     try
     cs.active :=true;
     showmessage('连接成功!');
     except
     showmessage('连接失败!');
     end;
end;

板凳


[em6]:
1、“if trim(remotehost)<>'' then
    if cs.Active then  cs.active:=true;”
-----上述语句有什么意义???完全是无意义的语句

2、你用的“cs”是什么东东的名字?哪个控件?
3、我的水平也不高,但我想高手也不懂你在问什么[em8]

我来回复

您尚未登录,请登录后再回复。点此登录或注册