VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "计算器"
   ClientHeight    =   1980
   ClientLeft      =   1095
   ClientTop       =   1515
   ClientWidth     =   5535
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   12
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1980
   ScaleWidth      =   5535
   Begin VB.CommandButton Command2 
      Caption         =   "结束"
      Height          =   495
      Left            =   3000
      TabIndex        =   5
      Top             =   1320
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   1320
      TabIndex        =   4
      Top             =   1320
      Width           =   855
   End
   Begin VB.TextBox Text4 
      Height          =   420
      Left            =   4200
      TabIndex        =   3
      Text            =   " "
      Top             =   720
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   420
      Left            =   3120
      TabIndex        =   2
      Top             =   720
      Width           =   615
   End
   Begin VB.TextBox Text2 
      Height          =   420
      Left            =   1680
      TabIndex        =   1
      Text            =   " "
      Top             =   720
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   420
      Left            =   480
      TabIndex        =   0
      Text            =   " "
      Top             =   720
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "计算结果"
      Height          =   375
      Left            =   4320
      TabIndex        =   9
      Top             =   240
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "输入操作符"
      Height          =   375
      Left            =   2880
      TabIndex        =   8
      Top             =   240
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "输入数2"
      Height          =   375
      Left            =   1680
      TabIndex        =   7
      Top             =   240
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "输入数1"
      Height          =   375
      Left            =   480
      TabIndex        =   6
      Top             =   240
      Width           =   855
   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 sInput1 As Single, sInput2 As Single
    Dim iError As Integer
    sInput1 = Val(Text1.Text)
    sInput2 = Val(Text2.Text)
    Select Case Trim(Text3)
    Case "+"
        Text4.Text = Str(sInput1 + sInput2)
    Case "-"
        Text4.Text = Str(sInput1 - sInput2)
    Case "*"
        Text4.Text = Str(sInput1 * sInput2)
    Case "/"
        If sInput2 Then
            Text4.Text = Str(sInput1 / sInput2)
        Else
            iError = MsgBox("分母为零,出错", vbRetryCancel)
            If iError = vbRetry Then
              Text2.Text = ""
              Text2.SetFocus
            Else
              End
            End If
       End If
    Case Else
            iError = MsgBox("运算符出错,再输入", vbRetryCancel)
            If iError = vbRetry Then
              Text3.Text = ""
              Text3.SetFocus
            Else
              End
            End If
    End Select

End Sub

Private Sub Command2_Click()
    End
End Sub

