急找VB告诉帮忙(悬赏积分20,如运行成功在赏5分)

来源:百度知道 编辑:UC知道 时间:2024/05/11 03:44:49
VB题:编一模拟袖珍计算器的完整程序,界面如图(图片另行发过去)要求:输入两个操作数和一个操作符,根据操作决定所做的运算。
提示:1.为了使程序运行正确,对存放操作的文本框Text3,应使用Trim(Text)函数,去除运算符两边的空格。2.对于存放操作符的文本框Text3,利用Select Case语句实现相应的运算 (需代码完整,如运行成功在赏5分)

Private Sub Command1_Click()
Dim fx As String
fx = Trim(Text3)
Select Case fx
Case "+":
re = Val(Text1) + Val(Text2)
Case "-":
re = Val(Text1) - Val(Text2)
Case "*":
re = Val(Text1) * Val(Text2)
Case "/":
re = Val(Text1) / Val(Text2)
Case "^"
re = Val(Text1) ^ Val(Text2)
End Select
Label1.Caption = "结果:" & Text1 & fx & Text2 & "=" & re
End Sub

o