vb程序设计中缺少语句结束 请大家帮帮忙Private Sub Command1_Click()显示的是在小时和vbCrLf这两处有错误
PrivateSubCommand1_Click()Dimhh%,mm%,ss%,Totals!DimOutstr$hh=Val(Text1)mm=Val(Text2)s...
Private Sub Command1_Click()
Dim hh%, mm%, ss%, Totals!
Dim Outstr$
hh = Val(Text1)
mm = Val(Text2)
ss = Val(Text3)
Totals = hh * 3600 + mm * 60 + ss
Outstr=hh&"小时 "&mm&"分 "&ss&"秒"
Outstr=Outstr&vbCrLf&"总计:"&Totals&"秒"
MsgBox Outstr, , "输出结果"
End Sub 展开
Dim hh%, mm%, ss%, Totals!
Dim Outstr$
hh = Val(Text1)
mm = Val(Text2)
ss = Val(Text3)
Totals = hh * 3600 + mm * 60 + ss
Outstr=hh&"小时 "&mm&"分 "&ss&"秒"
Outstr=Outstr&vbCrLf&"总计:"&Totals&"秒"
MsgBox Outstr, , "输出结果"
End Sub 展开
1个回答
展开全部
代码中的& 与变量名之间应该有空格隔开,你可以直接复制下面的代码,然后粘贴,
修改如下:
Private Sub Command1_Click()
Dim hh%, mm%, ss%, Totals!
Dim Outstr$
hh = Val(Text1)
mm = Val(Text2)
ss = Val(Text3)
Totals = hh * 3600 + mm * 60 + ss
Outstr = hh & "小时 " & mm & "分 " & ss & "秒"
Outstr = Outstr & vbCrLf & "总计:" & Totals & "秒"
MsgBox Outstr, , "输出结果"
End Sub
修改如下:
Private Sub Command1_Click()
Dim hh%, mm%, ss%, Totals!
Dim Outstr$
hh = Val(Text1)
mm = Val(Text2)
ss = Val(Text3)
Totals = hh * 3600 + mm * 60 + ss
Outstr = hh & "小时 " & mm & "分 " & ss & "秒"
Outstr = Outstr & vbCrLf & "总计:" & Totals & "秒"
MsgBox Outstr, , "输出结果"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询