请教time控件的使用 偶用time做个记时器 在time里编辑 label1.caption:=inttostr(strtoint(label1.caption)+1;---但运行时候出错自动删除了所有代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的括号都不匹配啊strtoint(label1.caption) 如果不能转换会出现异常 label1.caption内容固定吗,如果不固定用StrToIntDef(label1.caption,0) label1.caption:=inttostr(strtoint(label1.caption)+1);---这个是书上的代码呀 偶用time做个记时器 在time里编辑 label1.caption:=inttostr(strtoint(label1.caption)+1; ---但运行时候出错自动删除了所有代码label1.caption:=inttostr(strtoint(label1.caption)+1); ---这个是书上的代码呀 以上两次的代码一样吗? 在timer的事件里面写 设定时间间隔为1000 unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) Timer1: TTimer; Label1: TLabel; Button1: TButton; Button2: TButton; procedure Timer1Timer(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);begin label1.caption:=inttostr(strtoint(label1.caption)+1);end;procedure TForm1.Button1Click(Sender: TObject);begin Timer1.Enabled:=false; // stop the timerend;procedure TForm1.Button2Click(Sender: TObject);begin Timer1.Enabled:=true; // start the timerend;procedure TForm1.FormCreate(Sender: TObject);begin label1.caption:='1';end;end. 求助web service 对数据库的操作 请问关于多页面浏览器防假死技术!(欢迎高位高手指点) usb接口编程,有大虾做过吗 如何实现以下排序的算法 请教存储过程的嵌套问题 进来者就是风流倜傥,英俊潇洒,才高八斗,貌似藩安,号称一朵梨花压海棠,送绰号上天下 关于文件流的读写问题 我来报到,希望能加入你们. 为什么我的多线程退出的时候会蓝屏??? 不能用serversocket向clientsocket传送数据库数据吗? 解救:delphi写的DLL,powerbuilder调用出现问题。 我有一套标准的财务软件,delphi7+sql2000,如果有小型mis系统我们可以交换一下
strtoint(label1.caption)
如果不能转换会出现异常
---这个是书上的代码呀
---但运行时候出错自动删除了所有代码label1.caption:=inttostr(strtoint(label1.caption)+1);
---这个是书上的代码呀 以上两次的代码一样吗?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
begin
label1.caption:=inttostr(strtoint(label1.caption)+1);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=false; // stop the timer
end;procedure TForm1.Button2Click(Sender: TObject);
begin
Timer1.Enabled:=true; // start the timer
end;procedure TForm1.FormCreate(Sender: TObject);
begin
label1.caption:='1';
end;end.