送你一段编码~
Dim n, x As Integer
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub
Private Sub Command2_Click(Index As Integer)
If Index <> 0 Then
x = Val(Text1.Text)
Text1.Text = ""
n = Index - 1
Else
y = Val(Text1.Text)
Select Case n
Case 0
Text1.Text = x + y
Case 1
Text1.Text = x - y
Case 2
Text1.Text = x * y
Case 3
If y = 0 Then
MsgBox "除零错误"
Else
Text1.Text = x / y
End If
End Select
End If
End Sub