我是用控件数组做的也不能显示0望牛人解决
Dim x#, y#, op$Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 To 9
Me.Text1.Text = Me.Text1.Text & (Index).Caption
Case 10, 12, 13
x = Val(Me.Text1.Text)
Me.Text1.Text = ""
If Index = 10 Then op = "+"
If Index = 12 Then op = "X"
If Index = 13 Then op = "/"
Case 11
If Text1 = "" Then
Text1 = "-"
Else
x = Val(Me.Text1.Text)
Me.Text1.Text = ""
If Index = 11 Then op = "-"
End If
Case 15
y = Val(Text1)
If op = "+" Then Text1 = x + y
If op = "X" Then Text1 = x * y
If op = "/" Then Text1 = x / y
If op = "-" Then Text1 = x - y
Case 14
If InStr(Text1, ".") = 0 Then Me.Text1.Text = Me.Text1.Text & (Index).Caption
Case 16
Text1 = Left(Text1, Len(Text1) - 1)
Case 17
If Val(Text1) > 0 Then
Text1 = Val(Log(Text1))
Else
Text1 = "底数必须大于零"
End If
Case 18
Text1 = Text1 * Text1
Case 19
If InStr(Text1, "-") = 0 Then
Text1 = Sqr(Text1)
Else
Text1 = "被开方数不能小于零"
End If
Case 20
Text1 = ""
Case 21
Text1 = Val(Sin(Val((Text1) * 3.14159265358979 / 180)))
Case 22
Text1 = Val(Cos(Val((Text1) * 3.14159265358979 / 180)))
Case 23
Text1 = Val(Tan(Val((Text1) * 3.14159265358979 / 180)))
Case 24
Text1 = Val(Atn(Val((Text1) * 3.14159265358979 / 180)))
End Select
End Sub