Private Sub Command3_Click()
If X = "+" Then
now1 = Val(Text1.Text)
now1 = pre + now1
Text1.Text = now1
End If
End Sub
Private Sub Command4_Click()
pre = Val(Text1.Text)
Text1.Text = ""
X = "+"
怎么实现加法啊
Private Sub Command3_Click()
If X = "+" Then
now1 = Val(Text1.Text)
now1 = pre + now1
Text1.Text = now1
End If
End Sub
Private Sub Command4_Click()
pre = Val(Text1.Text)
Text1.Text = ""
X = "+"
怎么实现加法啊
“+,-,*,/”设一个按钮组
Private Sub Command2_Click(Index As Integer)
shu1 = Val(Text1.Text)
fuhao = Command2(Index).Caption
Text1.Text = ""
If fuhao = "+" Then
End If
If fuhao = "-" Then
End If
If fuhao = "*" Then
End If
If fuhao = "\" Then
End If
End Sub
等号的按钮的单击事件:
shu2 = Val(Text1.Text)
Select Case fuhao
Case "+"
Text1.Text = shu1 + shu2
Case "-"
Text1.Text = shu1 - shu2
Case "*"
Text1.Text = shu1 * shu2
Case "/"
If shu2 = 0 Then
MsgBox "除数不能为0"
Else
Text1.Text = shu1 / shu2
End If
End Select
差点忘了,要在声明部分:
Dim shu1 As Single
Dim shu2 As Single
Dim fuhao As String