Dim num1, num2 As Double
Dim sum As Double
Dim act As Integer
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
If Text1.Text = "" Then
Text1.Text = "0"
End If
Text1.Text = Text1.Text + "0"
Case 1
If Text1.Text = "" Then
Text1.Text = "1"
End If
Text1.Text = Text1.Text + "1"
Case 2
If Text1.Text = "" Then
Text1.Text = "2"
End If
Text1.Text = Text1.Text + "2"
Case 3
If Text1.Text = "" Then
Text1.Text = "3"
End If
Text1.Text = Text1.Text + "3"
Case 4
If Text1.Text = "" Then
Text1.Text = "4"
End If
Text1.Text = Text1.Text + "4"
Case 5
If Text1.Text = "" Then
Text1.Text = "5"
End If
Text1.Text = Text1.Text + "5"
Case 0
If Text1.Text = "" Then
Text1.Text = "6"
End If
Text1.Text = Text1.Text + "6"
Case 7
If Text1.Text = "" Then
Text1.Text = "7"
End If
Text1.Text = Text1.Text + "7"
Case 8
If Text1.Text = "" Then
Text1.Text = "8"
End If
Text1.Text = Text1.Text + "8"
Case 9
If Text1.Text = "" Then
Text1.Text = "9"
End If
Text1.Text = Text1.Text + "9"
Case 10
If Text1.Text = "" Then
Text1.Text = "."
End If
Case 11
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 1
Case 12
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 2
Case 13
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 3
Case 14
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 4
Case 15
num1 = CDbl(Text1.Text)
Text1.Text = ""
act = 5
Case 16
num1 = 0
num2 = 0
sum = 0
Text1.Text = ""
Case 17
num2 = CDbl(Text1.Text)
Select Case act
Case 1
sum = num1 + num2
Case 2
sum = num1 - num2
Case 3
sum = num1 * num2
Case 4
sum = num1 / num2
End Select
Text1.Text = ""
Text1.Text = sum
Case 18
End
End Select
End Sub
Private Sub Form_Load()
num1 = 0
num2 = 0
sum = 0
End Sub
问题补充:
哪里不对啊..