求个超简单VB写的计算器
- 提问者网友:泪痣哥哥
- 2021-08-11 00:37
- 五星知识达人网友:风格不统一
- 2021-08-11 01:54
- 1楼网友:煞尾
- 2021-08-11 04:07
您好
这是我的一个源程序
有需要的
可以联系QQ373903757
- 2楼网友:老鼠爱大米
- 2021-08-11 02:54
你看看能不能用吧。从别的地方copy过来的。
Dim str1 As String Dim str2 As String Dim x As String
Private Sub Command1_Click() Text1.Text = Text1.Text + "3" End Sub
Private Sub Command10_Click() x = "*" str1 = Text1.Text Text1.Text = "" End Sub
Private Sub Command11_Click() Text1.Text = Text1.Text + "7" End Sub
Private Sub Command12_Click() Text1.Text = Text1.Text + "8" End Sub
Private Sub Command13_Click() Text1.Text = Text1.Text + "." End Sub
Private Sub Command14_Click() Text1.Text = Text1.Text + "0" End Sub
Private Sub Command15_Click() str2 = Text1.Text Select Case x Case "+" Text1.Text = Val(str1) + Val(str2) Case "-" Text1.Text = Val(str1) - Val(str2) Case "*" Text1.Text = Val(str1) * Val(str2) Case "/" Text1.Text = Val(str1) / Val(str2) End Select
End Sub
Private Sub Command16_Click() x = "/" str1 = Text1.Text Text1.Text = "" End Sub
Private Sub Command17_Click() Text1.Text = "" End Sub
Private Sub Command2_Click() Text1.Text = Text1.Text + "1" End Sub
Private Sub Command3_Click() Text1.Text = Text1.Text + "2" End Sub
Private Sub Command4_Click() x = "+" str1 = Text1.Text Text1.Text = "" End Sub
Private Sub Command5_Click() x = "-" str1 = Text1.Text Text1.Text = "" End Sub
Private Sub Command6_Click() Text1.Text = Text1.Text + "9" End Sub
Private Sub Command7_Click() Text1.Text = Text1.Text + "4" End Sub
Private Sub Command8_Click() Text1.Text = Text1.Text + "5" End Sub
Private Sub Command9_Click() Text1.Text = Text1.Text + "6" End Sub