求助]用vb编写一个计算器
小弟是初学者 只会最简单的 单步 加减乘除
哪位 大大 能帮我完善完善计算器功能 比如 连续运算,储存调用数据 之类
万分感谢
代码是:Option Explicit
Dim c As Boolean
Dim cc As Boolean
Dim ccc As String
Dim cccc As String
Dim ccccc As String
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "打开一幅图片"
CommonDialog1.Action = 1
Image1.Picture = LoadPicture(CommonDialog1.FileName)
Image1.Visible = True
End Sub
Private Sub Command2_Click(Index As Integer)
If c = False Then
Select Case Index
Case 1
Text1.Text = Text1.Text & "1"
Case 2
Text1.Text = Text1.Text & "2"
Case 3
Text1.Text = Text1.Text & "3"
Case 4
Text1.Text = Text1.Text & "4"
Case 5
Text1.Text = Text1.Text & "5"
Case 6
Text1.Text = Text1.Text & "6"
Case 7
Text1.Text = Text1.Text & "7"
Case 8
Text1.Text = Text1.Text & "8"
Case 9
Text1.Text = Text1.Text & "9"
Case 0
Text1.Text = Text1.Text & "0"
End Select
cccc = Text1.Text
End If
c = False
End Sub
Private Sub Command3_Click()
If cc = False Then
Text1.Text = Text1.Text & "."
End If
c = False
cc = True
End Sub
Private Sub Command5_Click(Index As Integer)
c = False
cc = False
Select Case Index
Case 0
ccc = "+"
Case 1
ccc = "-"
Case 2
ccc = "*"
Case 3
ccc = "/"
End Select
'将变量cccc的值赋予变量ccccc , 使变量ccccc作为第一个输入的数字
'并让程序在此单击事件中记住第一个数字,同时清空text1.text,还原变量c
'和变量cc,c和cc是两个标示符,还原的目的是不影响第二个数字的输入。
ccccc = cccc
Text1.Text = ""
c = False
cc = False
End Sub
Private Sub Command6_Click()
Select Case ccc
Case "+"
Text1.Text = Val(ccccc) + Val(cccc)
Case "-"
Text1.Text = Val(ccccc) - Val(cccc)
Case "*"
Text1.Text = Val(ccccc) * Val(cccc)
Case "/"
Text1.Text = Val(ccccc) / Val(cccc)
End Select
End Sub
Private Sub Command7_Click()
Text1.Text = ""
c = False
cc = False
End Sub
Private Sub Form_Load()
c = False
cc = False
End Sub