帮忙用vb制作一个简单的计算器,只需要有0--9 ,加减乘除等于,小数点,和清除退出按钮即可?

请把按钮命名过程写清楚!谢谢
2025-01-02 17:38:21
推荐回答(3个)
回答1:

只要按代码要求建立控件就可以了
Private Sub Command1_Click(index As Integer)
Select Case index
Case 0
Text3.Text = Val(Text1.Text) + Text2.Text
Case 1
Text3.Text = Val(Text1.Text) - Text2.Text
Case 2
Text3.Text = Val(Text1.Text * Text2.Text)
Case 3
Text3.Text = Val(Text1.Text) / Text2.Text
Case 4
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Form1.Cls
Case 5
End
End Select
End Sub
Private Sub Command1_Click(index As Integer)
Select Case index
Case 0
Text3.Text = Val(Text1.Text) + Text2.Text
Case 1
Text3.Text = Val(Text1.Text) - Text2.Text
Case 2
Text3.Text = Val(Text1.Text * Text2.Text)
Case 3
Text3.Text = Val(Text1.Text) / Text2.Text
Case 4
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Form1.Cls
Case 5
End
End Select
End Sub
Private Sub Command1_Click(index As Integer)
Select Case index
Case 0
Text3.Text = Val(Text1.Text) + Text2.Text
Case 1
Text3.Text = Val(Text1.Text) - Text2.Text
Case 2
Text3.Text = Val(Text1.Text * Text2.Text)
Case 3
Text3.Text = Val(Text1.Text) / Text2.Text
Case 4
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Form1.Cls
Case 5
End
End Select
End Sub

回答2:

123
456 456
789
0#*

回答3:

楼主网上有好多源码啊 ,你随便搜一下就有一大堆啊,自己下一个吧