这是我很久以前编的了 你看下吧
先声明:完全白痴的编程
Private Sub Command1_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
'上面作用是为了在运算完一个算式,数据都存在的情况下,点任意一个数字键(包括小数点),都会自动清除显示屏的值和下面算式的值
'如果没有判断的话,就会出现算完再点一个数字,数字从显示屏最末尾出现的尴尬现象(就等于在输入数据)
Text1 = Text1 + "7"
End Sub
Private Sub Command10_Click()
Dim tuige, tuige1
tuige = Val(Text1)
tuige1 = tuige Mod 10
tuige = tuige - tuige1
tuige = tuige / 10
Text1 = tuige
End Sub
Private Sub Command11_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "1"
End Sub
Private Sub Command12_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "2"
End Sub
Private Sub Command13_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "3"
End Sub
Private Sub Command14_Click()
Dim fanhui
If Text1 <> "" Then
fanhui = Text1
Label1 = fanhui
Else
Label1 = Label1
End If
Label2 = "-"
Label3 = ""
Label4 = ""
Label5 = ""
Text1 = ""
End Sub
Private Sub Command15_Click()
Dim pingfang
pingfang = Val(Text1)
If pingfang < 0 Then
pingfang = 0 - pingfang
End If
pingfang = Sqr(pingfang)
Text1 = pingfang
End Sub
Private Sub Command16_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "0"
End Sub
Private Sub Command17_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
If Text1 = "" Then
Text1 = "0."
Else
Text1 = Text1 + "."
End If
End Sub
Private Sub Command18_Click()
Text1 = 0 - Text1
End Sub
Private Sub Command19_Click()
Dim fanhui
If Text1 <> "" Then
fanhui = Text1
Label1 = fanhui
Else
Label1 = Label1
End If
Label2 = "+"
Label3 = ""
Label4 = ""
Label5 = ""
Text1 = ""
End Sub
Private Sub Command2_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "8"
End Sub
Private Sub Command20_Click()
If Label2 = "+" Then
Label3 = Text1
Label4 = "="
Text1 = Val(Label1) + Val(Text1)
Label5 = Text1
End If
If Label2 = "-" Then
Label3 = Text1
Label4 = "="
Text1 = Val(Label1) - Val(Text1)
Label5 = Text1
End If
If Label2 = "*" Then
Label3 = Text1
Label4 = "="
Text1 = Val(Label1) * Val(Text1)
Label5 = Text1
End If
If Label2 = "÷" Then
If Val(Text1) = 0 Then
Text1 = "E"
Else
Label3 = Text1
Label4 = "="
Text1 = Val(Label1) / Val(Text1)
Label5 = Text1
End If
End If
End Sub
Private Sub Command3_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "9"
End Sub
Private Sub Command4_Click()
Dim fanhui
If Text1 <> "" Then
fanhui = Text1
Label1 = fanhui
Else
Label1 = Label1
End If
Label2 = "÷"
Label3 = ""
Label4 = ""
Label5 = ""
Text1 = ""
End Sub
Private Sub Command5_Click()
Text1 = ""
Label1 = ""
Label2 = ""
Label3 = ""
Label4 = ""
Label5 = ""
End Sub
Private Sub Command6_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "4"
End Sub
Private Sub Command7_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "5"
End Sub
Private Sub Command8_Click()
If Label5 <> "" And Label5 = Text1 Then
Text1 = ""
Label1 = "": Label2 = "": Label3 = "": Label4 = "": Label5 = ""
End If
Text1 = Text1 + "6"
End Sub
Private Sub Command9_Click()
Dim fanhui
If Text1 <> "" Then
fanhui = Text1
Label1 = fanhui
Else
Label1 = Label1
End If
Label2 = "*"
Label3 = ""
Label4 = ""
Label5 = ""
Text1 = ""
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label6_Click()
shunzi = MsgBox("你好,**测试版,BUG一堆!", 1, "提示^_^")
End Sub
Private Sub Label7_Click()
shunzis = MsgBox("1,小数退格错误。2,小数点不该连按", 1, "已知BUG汇总")
End Sub
Private Sub Command1_Click()
Dim sc As Object
Set sc = CreateObject("ScriptControl")
sc.Language = "VBScript"
Text2.Text = sc.Eval(Text1.Text)
EndSub 在text1里输入你的算式 按command1即可