VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4950
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5625
   LinkTopic       =   "Form1"
   ScaleHeight     =   4950
   ScaleWidth      =   5625
   StartUpPosition =   3  '敦諳吽
   Begin VB.TextBox Text1 
      BackColor       =   &H80000018&
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "0.0000"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   1
      EndProperty
      BeginProperty Font 
         Name            =   "Bookman Old Style"
         Size            =   15
         Charset         =   0
         Weight          =   600
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   720
      TabIndex        =   10
      Text            =   "0."
      Top             =   600
      Width           =   2655
   End
   Begin VB.CommandButton Command1 
      Caption         =   "壺"
      Height          =   495
      Index           =   16
      Left            =   4080
      TabIndex        =   17
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "0"
      BeginProperty Font 
         Name            =   "冼极"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Index           =   0
      Left            =   480
      TabIndex        =   16
      Top             =   4200
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "/"
      BeginProperty Font 
         Name            =   "冼极"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Index           =   15
      Left            =   1560
      TabIndex        =   15
      Top             =   4200
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "冼极"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Index           =   10
      Left            =   2880
      TabIndex        =   14
      Top             =   4200
      Width           =   735
   End

解决方案 »

  1.   

    Begin VB.CommandButton Command1 
          Caption         =   "="
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   11
          Left            =   4080
          TabIndex        =   13
          Top             =   4080
          Width           =   1215
       End
       Begin VB.CommandButton Command1 
          Caption         =   "7"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   7
          Left            =   480
          TabIndex        =   12
          Top             =   3360
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "8"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   8
          Left            =   1680
          TabIndex        =   11
          Top             =   3360
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "9"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   9
          Left            =   2880
          TabIndex        =   9
          Top             =   3360
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "*"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   14
          Left            =   4080
          TabIndex        =   8
          Top             =   3240
          Width           =   1215
       End
       Begin VB.CommandButton Command1 
          Caption         =   "-"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   18
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   13
          Left            =   4080
          TabIndex        =   7
          Top             =   2520
          Width           =   1215
       End
      

  2.   

    Begin VB.CommandButton Command1 
          Caption         =   "6"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   6
          Left            =   2880
          TabIndex        =   6
          Top             =   2520
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "5"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   5
          Left            =   1680
          TabIndex        =   5
          Top             =   2520
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "4"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   4
          Left            =   480
          TabIndex        =   4
          Top             =   2520
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "+"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   18
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   12
          Left            =   4080
          TabIndex        =   3
          Top             =   1680
          Width           =   1215
       End
       Begin VB.CommandButton Command1 
          Caption         =   "3"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   3
          Left            =   2880
          TabIndex        =   2
          Top             =   1680
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "2"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   2
          Left            =   1680
          TabIndex        =   1
          Top             =   1680
          Width           =   735
       End
       Begin VB.CommandButton Command1 
          Caption         =   "1"
          BeginProperty Font 
             Name            =   "冼极"
             Size            =   15
             Charset         =   134
             Weight          =   700
             Underline       =   0   'False
             Italic          =   0   'False
             Strikethrough   =   0   'False
          EndProperty
          Height          =   495
          Index           =   1
          Left            =   480
          TabIndex        =   0
          Top             =   1680
          Width           =   735
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
      

  3.   

    Dim Num1, Num2 As Single
    Dim StrNum1, StrNum2 As String
    Dim FirstNum As Boolean '瓚剿岆瘁岆杅趼羲芛
    Dim PointFlag As Boolean '瓚剿岆瘁眒衄苤杅萸
    Dim Runsign As Integer '揣湔堍呾睫瘍
    Dim SignFlag As Boolean '瓚剿岆瘁眒衄堍呾睫瘍
    Sub ClearData()Num1 = 0
    Num2 = 0
    StrNum1 = ""
    StrNum2 = ""
    FirstNum = True
    PointFlag = False
    Runsign = 0
    SignFlag = False
    Text1.Text = "0."End Sub
    Sub Run()
    Num1 = Val(StrNum2)
    Num2 = Val(StrNum1)
    Select Case Runsign
    Case 1
    equal = Num1 + Num2
    Case 2
    equal = Num1 - Num2
    Case 3
    equal = Num1 * Num2
    Case 4
    equal = Num1 / Num2
    End Select
    StrNum2 = Str(equal)
    StrNum1 = StrNum2
    Text1.Text = StrNum1
    End Sub
    Private Sub Command1_Click(Index As Integer)Select Case Index
    Case 0 To 9
    If FirstNum Then
       StrNum1 = Str(Index)
       FirstNum = False
    Else
       StrNum1 = StrNum1 + Str(Index)
    End If
    Text1.Text = StrNum1
    Case 10
    If Not PointFlag Then
       If FirstNum Then
          StrNum1 = "0."
          FirstNum = False
       Else
          StrNum1 = StrNum1 + "."
       End If
    Else
       Exit Sub
    End If
       PointFlag = True
       Text1.Text = StrNum1
    Case 12 To 15
       FirstNum = True
       PointFlag = False
    '遜埻梓暮硉
    If SignFlag Then
       Call Run
    Else
       SignFlag = True
       StrNum2 = StrNum1
       StrNum1 = ""
    End If
    Runsign = Index - 11
    Case 11
    If Not SignFlag Then
       Text1.Text = StrNum1
       equal = Val(StrNum1)
       FirstNum = True
       PointFlag = False
    Else
       Call Run
       SignFlag = False
    End If
    Case 16
    Call ClearData
    End Select
    End Sub
    Private Sub Form_Load()Call ClearDataEnd Sub
      

  4.   

    to: snakeyin(水是我) 
    等等,等等,我看着有点晕,窗体中怎么那么多COMMAND1?没看出什么道道啊,解释一下行吗?
      

  5.   

    TO:sunnycai(飞鸟) 
       感谢飞鸟,我找到例子了,接分。
       同样感谢snakeyin(水是我) 参与,也有分。