vb计算器就差最关键的了,谢谢!急!
来源:百度知道 编辑:UC知道 时间:2024/06/14 14:44:55
我的代码:
Dim a As String
Dim b As String
Private Sub Command1_Click()
Label1.Caption = Label1.Caption & "1"
End Sub
Private Sub Command10_Click()
Label1.Caption = Label1.Caption & "8"
End Sub
Private Sub Command11_Click()
Label1.Caption = Label1.Caption & "9"
End Sub
Private Sub Command14_Click()
Label1.Caption = Label1.Caption & "."
End Sub
Private Sub Command2_Click()
Label1.Caption = Label1.Caption & "2"
End Sub
Private Sub Text1_Change()
End Sub
Private Sub Command3_Click()
Label1.Caption = Label1.Caption & "3"
End Sub
Private Sub Command4_Click()
End Sub
Private Sub Command5_Click()
Label1.Caption = Label1.Caption & "4"
End Sub
Private Sub Command6_Click()
L
Option Explicit
Private StoredValue As Double
Private Const opNone = 0
Private Const opAdd = 1
Private Const opSubtract = 2
Private Const opMultiply = 3
Private Const opDivide = 4
Private Operator As Integer
Private NewEntry As Boolean
' Remove the last character.
Private Sub DeleteCharacter()
Dim txt As String
Dim min_len As Integer
txt = txtDisplay.Text
If Left$(txt, 1) = "-" Then
min_len = 2
Else
min_len = 1
End If
If Len(txt) > min_len Then
txtDisplay.Text = Left$(txt, Len(txt) - 1)
Else
txtDisplay.Text = "0"
End If
End Sub
' Clear the current entry, saved value, and operator.
Private Sub cmdClear_Click()
cmdClearEntry_Click
StoredValue = 0
Operator = opNone
End Sub
' Clear the current entry.
Private Sub cmdClearEntry_Click()
txtDispla