编写一个程序,由键盘输入小时、分、秒以后,将输入转换成共有多少秒,并显示计算结果。
设置三个控制按钮:“输入数据”按钮控制输入数据;“计算”按钮进行计算;“退出”按钮控制退出程序。
请大家看看这个错误在那里
Private Sub Command1_Click()
a = Text1
b = Text2
c = Text3
d = a + b * 60 + c * 3600
If a < 0 Then
MsgBox ("输入数据有误")
Text1.Text = ""
Text1.Text = ""
Text1.Text = ""
ElseIf b < 0 Then
MsgBox ("输入数据有误")
Text2.Text = ""
Text2.Text = ""
Text2.Text = ""
ElseIf c < 0 Then
MsgBox ("输入数据有误")
Text3.Text = ""
Text3.Text = ""
Text3.Text = ""
Else
List1.Caption = "共有" & d & "秒"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
End If
End Sub
Private Sub Command3_Click()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Label1.Caption = ""
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
End Sub