请在窗体上放2个textbox(文本框)和4个commandbutton(命令按钮)和1个label(标签),再输入以下代码 :
Dim a%, b%, c%
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = a + b
Label1.Caption = Label1.Caption & c
End Sub
Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = a * b
Label1.Caption = Label1.Caption & c
End Sub
Private Sub Command3_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = a - b
Label1.Caption = Label1.Caption & c
End Sub
Private Sub Command4_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = a / b
Label1.Caption = Label1.Caption & c
End Sub
给出这个程序
select case f
case "+"
msgbox val(text1)+val(text2)
case "-"
msgbox val(text1)-val(text2)
case “*”
msgbox val(text1)*val(text2)
case "/"
msgbox val(text1)\val(text2)
end select
vb计算器 整个工程代码提供