用vb.net做计算器 vb实现计算器

VB.net作业,用VB做一个简单的计算器.我用VB做的你看能不能用
Public b
Public c
Public d
Public e
Public f
Private Sub Command14_Click()
d = ""
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Exit Sub
'c = Text1.Text
If b = "" Then Exit Sub
If e = " " Then
d = fb
Else
If e = "-" Then
d = f - b
Else
If e = "*" Then
d = f * b
Else
If e = "/" Then
If b = 0 Then
MsgBox "被除数不能为零!"
Exit Sub
End If
d = f / b
Else
MsgBox "错误操作!"
End If
End If
End If
End If
Text1.Text = d
b = ""
c = ""
e = ""
End Sub
Private Sub Command15_Click()
Text1.Text = ""
b = ""
c = ""
d = ""
e = ""
f = ""
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Command1_Click()
'判断开头有运算符就清零
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
'判断开头有0就禁止输入数字
If Text1.Text = "0" Then
Else
a = 1
'发现运算结果就清零
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text '得到当前操作数
End Sub
Private Sub Command2_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 2
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command3_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 3
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command4_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 4
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command5_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 5
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command6_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 6
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command7_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 7
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command8_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 8
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command9_Click()
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
If Text1.Text = "0" Then
Else
a = 9
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
End If
b = Text1.Text
End Sub
Private Sub Command10_Click()
If b = "" Then Exit Sub
a = " "
e = " "
f = b
Text1.Text = ""
Text1.Text = Text1.Texta
End Sub
Private Sub Command11_Click()
If b = "" Then Exit Sub
f = b
a = "-"
e = "-"
Text1.Text = ""
Text1.Text = Text1.Texta
End Sub
Private Sub Command12_Click()
If b = "" Then Exit Sub
a = "*"
e = "*"
f = b
Text1.Text = ""
Text1.Text = Text1.Texta
End Sub
Private Sub Command13_Click()
If b = "" Then Exit Sub
a = "/"
e = "/"
f = b '把操作数1提取出来
Text1.Text = ""
Text1.Text = Text1.Texta
End Sub
Private Sub Command16_Click()
'判断有运算符就清零
If Text1.Text = " " Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""
'判断有零和空值就禁止输入0
'发现运算结果就清零
If d"" Then Text1.Text = "": d = ""
If Text1.Text = "0" Then
Else
a = 0
If d"" Then Text1.Text = "": d = ""
Text1.Text = Text1.Texta
b = Text1.Text
End If
End Sub
如何用VB.NET编写计算器简单用vb.net做计算器的说拖出一些控件用vb.net做计算器,设置相应用vb.net做计算器的caption和属性等等,双击每个button控件,进行相应用vb.net做计算器的处理,即可
VB.NET怎么编模拟袖珍计算器的完整程序?Public C护激篙刻蕻灸戈熏恭抹lass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim c As Char
c = Trim(TextBox3.Text)
Select Case c
Case " "
TextBox4.Text = Val(TextBox1.Text)Val(TextBox2.Text)
Case "-"
TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Case "*"
TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Case "\"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)
End If
Case "/"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
用VB.NET做一个简单的计算器,当然是做的越高级越好,不要生成的EXE 。连程序一起发过来 。采纳追加500分!计算机光要加减乘除的那种吗?
先在窗口添加一个textbox文本框名字是textbox1,再添加一个标签,属性text:(为一个空格)名字是label1,再加一个textbox文本框,名字是textbox2,加标签,名字是label2,属性text:“=”(引号不算),在后面加一个文本框,名字为textbox3.下一行添加五个按钮 , 名字分别是Button1(属性text:加),Button2(属性text:减).……最后一个是 , 清空 , 按钮
双击Button1,输入代码:dim a,b,c as single(回车!)a=textbox1.text(!)b=textbox2.text(!)a b=c(!),textbox3=c(!)
后面分别点击不同的按钮,把“ ”改成“-”,“*”“/”行了
双击最后按钮输入textbox1=""(!)textbox2=""(!)textbox3=""就ok了,累死我了呵呵(?。┍硎净爻蛋?
【用vb.net做计算器 vb实现计算器】关于用vb.net做计算器和vb实现计算器的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读