标题:初学者请教,谢谢啦!
只看楼主
喜欢你没道理
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2006-9-22
 问题点数:0 回复次数:3 
初学者请教,谢谢啦!

Dim pretime As Integer, mm As Integer, ss As Integer

Private Sub CmdStart_Click()
CmdStart.Enabled = False
Timer1.Enabled = True
pretime = Val(InputBox("请输入倒计的时间?"))
mm = pretime / 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
End Sub

Private Sub Timer1_Timer()
mm = pretime / 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
If mm = 0 And ss = 0 Then
Label1.Caption = "时间到"
Timer1.Enabled = False
CmdStart.Enabled = True
End If
pretime = pretime - 1
End Sub

为什么运行后,好像是多计了1分钟。

搜索更多相关主题的帖子: False False 
2006-11-06 16:03
atomhdp
Rank: 1
等 级:新手上路
帖 子:97
专家分:0
注 册:2005-10-2
得分:0 
mm = pretime / 60
改成
mm = pretime \ 60
试试 .

2006-11-06 16:13
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
得分:0 
Dim pretime As Integer, mm As Integer, ss As Integer

Private Sub CmdStart_Click()
cmdstart.Enabled = False
Timer1.Enabled = True
pretime = Val(InputBox("请输入倒计的时间?"))
mm = pretime \ 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
End Sub

Private Sub Command1_Click()

End Sub

Private Sub Timer1_Timer()
mm = pretime \ 60
ss = pretime Mod 60
Label1.Caption = Str(mm) & "分" & Str(ss) & "秒"
If mm = 0 And ss = 0 Then
Label1.Caption = "时间到"
Timer1.Enabled = False
cmdstart.Enabled = True
End If
pretime = pretime - 1
End Sub

我的msn: myfend@
2006-11-06 17:02
喜欢你没道理
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2006-9-22
得分:0 
好了,是这个问题呀!谢谢高手们,大家天天开心哦
2006-11-06 19:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-101085-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.227269 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved