匿名用户
1级
2010-07-14 回答
展开全部
将下面代码复制到txt文件中,并将其保存为Form1.frm,然后运行
但是要注意:填入的时间不能隔日,即开始时间与结束时间都必须在同一天。
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6165
ClientLeft = 60
ClientTop = 450
ClientWidth = 10035
LinkTopic = "Form1"
ScaleHeight = 6165
ScaleWidth = 10035
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "计 算"
Height = 495
Left = 3480
TabIndex = 10
Top = 3120
Width = 1215
End
Begin VB.TextBox Text4
Height = 495
Left = 4920
TabIndex = 8
Text = "8"
Top = 1200
Width = 615
End
Begin VB.TextBox Text3
Height = 495
Left = 3960
TabIndex = 6
Text = "5"
Top = 1200
Width = 615
End
Begin VB.TextBox Text2
Height = 495
Left = 4920
TabIndex = 5
Text = "5"
Top = 480
Width = 615
End
Begin VB.TextBox Text1
Height = 495
Left = 3960
TabIndex = 4
Text = "3"
Top = 480
Width = 615
End
Begin VB.Label Label6
Height = 495
Left = 2880
TabIndex = 9
Top = 2400
Width = 2535
End
Begin VB.Label Label4
Caption = ":"
Height = 495
Left = 4680
TabIndex = 7
Top = 1320
Width = 135
End
Begin VB.Label Label5
Height = 495
Left = 3000
TabIndex = 3
Top = 1920
Width = 2535
End
Begin VB.Label Label3
Caption = ":"
Height = 495
Left = 4680
TabIndex = 2
Top = 720
Width = 135
End
Begin VB.Label Label2
Caption = "结束时间"
Height = 495
Left = 3000
TabIndex = 1
Top = 1320
Width = 855
End
Begin VB.Label Label1
Caption = "开始时间"
Height = 255
Left = 3000
TabIndex = 0
Top = 600
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim T1 As Integer, T2 As Integer, T3 As Integer
T1 = Val(Text1) * 60 + Val(Text2)
T2 = Val(Text3) * 60 + Val(Text4)
T3 = T2 - T1
Label5 = "总分钟数:" & T3
Label6 = "总金额(元):" & Int((T3 / 60 * 2.5) * 10 + 0.5) / 10
End Sub