怎样用vb编程使在文本框中输入的秒数,单击命令按钮后转换成时分秒并在便签上显示
3个回答
展开全部
Private Sub Command1_Click()
Dim i, j, iHour, iMinute, iSecond As Integer
i = Val(Text1.Text)
iSecond = i Mod 60
i = i \ 60
iMinute = i Mod 60
i = i \ 60
iHour = i Mod 60
Label1.Caption = Str(iHour) & "小时" & Str(iMinute) & "分" & Str(iSecond) & "秒"
End Sub
Dim i, j, iHour, iMinute, iSecond As Integer
i = Val(Text1.Text)
iSecond = i Mod 60
i = i \ 60
iMinute = i Mod 60
i = i \ 60
iHour = i Mod 60
Label1.Caption = Str(iHour) & "小时" & Str(iMinute) & "分" & Str(iSecond) & "秒"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Val(Text1.Text)
If a > 60 Then
c = a Mod 60
b = (a - c) / 60
Else
b = 0: c = a
End If
Label1.Caption = Str(b) & "分" & Str(c) & "秒"
End Sub
数值输入的不要太大 否则会溢出 我没有考虑小时的问题~
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Val(Text1.Text)
If a > 60 Then
c = a Mod 60
b = (a - c) / 60
Else
b = 0: c = a
End If
Label1.Caption = Str(b) & "分" & Str(c) & "秒"
End Sub
数值输入的不要太大 否则会溢出 我没有考虑小时的问题~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-03-27
展开全部
MsgBox DateAdd("s",3661,"00:00:00")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询