VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算电话费"
   ClientHeight    =   2655
   ClientLeft      =   1095
   ClientTop       =   1515
   ClientWidth     =   3360
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   9.75
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2655
   ScaleWidth      =   3360
   Begin VB.TextBox Text4 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1920
      TabIndex        =   7
      TabStop         =   0   'False
      Top             =   2160
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   480
      TabIndex        =   6
      TabStop         =   0   'False
      Top             =   2160
      Width           =   1095
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1920
      TabIndex        =   3
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   1920
      TabIndex        =   1
      Top             =   360
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "通话费用"
      Height          =   375
      Left            =   2040
      TabIndex        =   5
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "通话时间"
      Height          =   375
      Left            =   480
      TabIndex        =   4
      Top             =   1800
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "通话结束hh:mm:ss"
      Height          =   615
      Left            =   480
      TabIndex        =   2
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "通话开始hh:mm:ss"
      Height          =   495
      Left            =   480
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim t1 As Date, t2 As Date


Private Sub Text2_KeyPress(KeyAscii As Integer)
  Dim st!, hours!, Money!
  If KeyAscii = 13 Then
    st = DateDiff("s", CDate(Text1), CDate(Text2)) / 60    '求两时间相差的分钟数
    Text3.Text = Format(st, "0.00") + "  分钟"
    If st <= 3 Then                                       '计算通话费
        Money = 0.5
    Else
        Money = 0.5 + (st - 3) * 0.15
    End If
    hours = Val(Mid(Text1, 1, 2))
    If hours < 7 Or hours > 19 Then                        '是否在优惠的时间段内
      Money = Money * 0.5
    End If
    Text4.Text = Format(Str(Money), "$0.00") + " 元"
   End If
End Sub

