label2.Caption:=程序每隔2分钟,执行加1并赋值给label2,程序要如何写?网上说要用到Timer,具体不知如何实现;

解决方案 »

  1.   

    首先设置timer的interval属性为两分钟
    然后在ontimer事件里赋值就可以了
      

  2.   

    恩 timer 基本就能解决你问题了。。
      

  3.   

    是的,2分钟interval的值就是120000.
      

  4.   

    timer的interval属性为120000
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       label2.Caption:=inttostr(strtoint(label2.Caption)+1);//前提是Caption是数字,如果有其他字符,则需要处理一下
    end;
      

  5.   

    timer的时间会不会不准????
      

  6.   

    感谢各位的回答,经测试可以了.正如de410所说"前提是Caption是数字,如果有其他字符,则需要处理一下 "所以把Label.Caption的初始值设为0