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

为什么ftp前,无法改变label.caption的值?该如何处理

2012-03-07 
为什么ftp前,无法改变label.caption的值?代码如下:procedureTForm1.Button2Click(Sender:TObject)beginla

为什么ftp前,无法改变label.caption的值?
代码如下:

procedure   TForm1.Button2Click(Sender:   TObject);
begin
      label1.Caption:= '开始上传 ';
      idftp1.Host:= '192.168.148.104 ';
      idftp1.Port:=21;
      idftp1.Username:= 'test ';
      idftp1.Password   := '1234 ';
      myftp( 'e:\asp\file.asp ', 'file1.asp ',2);//自定义的一个ftp过程
end;

程序运行后,文件已经成功上传,但是label1的caption却并没有变为 '开始上传 ',如果取消掉后面的myftp( 'e:\asp\file.asp ', 'file1.asp ',2)则可以显示,但是myftp过程中并没有任何关于label1.caption的操作

procedure   TForm1.myftp(s:string;m:string;mtype:integer);
begin
idftp1.connect;
if   idFTP1.Connected   then
  begin
    case   mtype   of
    1:
      begin
        ProgressBar1.Max:=idftp1.Size(s);
        idftp1.Get(s,m,true);
      end;
    2:
      begin
        ProgressBar1.Max:=filesizebyname(s);
        idftp1.Put(s,m,true);
      end;
    end;
  idftp1.Disconnect;
  end
  else
  idftp1.Disconnect;
end;


[解决办法]
label1.Caption:= '开始上传 ';
self.update;

热点排行