Dim s As Double
Dim k1 As Double
Dim k2 As Double
Dim n As Integer
 Private Sub Command1_Click(Index As Integer)

 Select Case Index
Case 1
Text1.Text = Text1.Text & 1
Case 2
Text1.Text = Text1.Text & 2
Case 3
Text1.Text = Text1.Text & 3
Case 4
Text1.Text = Text1.Text & 4
Case 5
Text1.Text = Text1.Text & 5
Case 6
Text1.Text = Text1.Text & 6
Case 7
Text1.Text = Text1.Text & 7
Case 8
Text1.Text = Text1.Text & 8
Case 9
Text1.Text = Text1.Text & 9
Case 0
Text1.Text = Text1.Text & 0
Case 10
Text1.Text = Text1.Text & "."
End Select
End Sub

Private Sub Command10_Click()
k1 = Val(Text1.Text)
If k1 <= 0 Then
MsgBox "您输入的数据有误,请重新输入!", vbOKOnly + vbCritical, "错误!"
Exit Sub
End If
s = Log(k1)
Text1.Text = ""
Text1.Text = s
End Sub

Private Sub Command11_Click()
k1 = Val(Text1.Text)
s = Sin(k1 * 3.1415926 / 180)
Text1.Text = s
End Sub

Private Sub Command12_Click()
k1 = Val(Text1.Text)
s = Cos(k1 * 3.1415926 / 180)
Text1.Text = s
End Sub

Private Sub Command13_Click()
k1 = Val(Text1.Text)
s = Tan(k1 * 3.1415926 / 180)
Text1.Text = s
End Sub

Private Sub Command14_Click()
k1 = Val(Text1.Text)
s = Atn(k1 * 3.1415926 / 180)
Text1.Text = s
End Sub

Private Sub Command15_Click()
k1 = Val(Text1.Text)
j = 1
For i = 1 To k1
 j = i * j
 Next i
 Text1.Text = j
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
k2 = Val(Text1.Text)
Select Case n
Case 0
s = s + k2
Case 1
s = s - k2
Case 2
s = k1 * k2
Case 3
s = k1 / k2
End Select
Text1.Text = CStr(s)
End Sub

Private Sub Command4_Click(Index As Integer)
k1 = Val(Text1.Text)
Text1.Text = ""
n = Index
If n = 0 Then
s = s + k1
Exit Sub
End If
If n = 1 Then
 If s = 0 Then
  s = k1 - s
  Else
   s = s - k1
   End If
Exit Sub
End If
End Sub

Private Sub Command5_Click()
Text1.Text = ""
k1 = 0
k2 = 0
s = 0
End Sub

Private Sub Command6_Click()
While Len(Text1.Text) - 1 >= 0
Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)
Exit Sub
Wend
End Sub

Private Sub Command7_Click()
s = Sqr(Val(Text1.Text))
Text1.Text = s
End Sub

Private Sub Command8_Click()
k1 = Val(Text1.Text)
s = k1 * k1
Text1.Text = s
End Sub

Private Sub Command9_Click()
k1 = Val(Text1.Text)
s = k1 * k1 * k1
Text1.Text = s
End Sub