(VB)设计一个简单的加减法计算器,输入两个数,然后选择所需的运算符“+”或“-”,

来源:百度知道 编辑:UC知道 时间:2024/05/30 21:30:20
其结果显示在一个文本框中
我的邮箱是uxning@sina.com

这是一个带菜单的,可以用鼠标右键,你要的话我给你发过去,我的mail: fudi850@163.com
Option Explicit

Private Sub Command1_Click()

Unload mnu(1)
End Sub

Private Sub Form_Load()
mnu(0).Caption = "chengfang"
mnu(0).Visible = True
Load mnu(1)
mnu(1).Caption = "lifang"
mnu(1).Visible = True
Load mnu(2)
mnu(2).Caption = "n次方"
mnu(2).Visible = True

End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
mnuw.PopupMenu mnuc
End If

End Sub

Private Sub mnu_Click(Index As Integer)
Dim i As Integer
If Index = 0 Then
Label2.Caption = "^2"
Text3.Text = Val(Text1.Text) * Val(Text1.Text)
ElseIf Index = 1 Then
Label2.Caption = "^3"
Text3.Text = Val(Text1.Text) * Val(T