vb点虐 怎么做计算器 vbs做计算器-成都快上网建站

vb点虐 怎么做计算器 vbs做计算器

有关vb点虐 制作计算器的问题

判断吧,如果点击+按肢链钮,则一个全局变量为1,-按钮,则全闹陵局变量为2.以此类推,历弯孙然后if或case判断哪个数,如果为1,就两个数相加。

成都创新互联公司是一家集网站建设,师宗企业网站建设,师宗品牌网站建设,网站定制,师宗网站建设报价,网络营销,网络优化,师宗网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

VB点虐 作业,用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 = f + b

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

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.Text a

End Sub

Private Sub Command11_Click()

If b = "" Then Exit Sub

f = b

a = "-"

e = "-"

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command12_Click()

If b = "" Then Exit Sub

a = "*"

e = "*"

f = b

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command13_Click()

If b = "" Then Exit Sub

a = "/"

e = "/"

f = b '把操作数1提取出来

Text1.Text = ""

Text1.Text = Text1.Text a

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.Text a

b = Text1.Text

End If

End Sub

如何用vb编写简单计算器

不知道你想要哪种,偶是新手,只会最简单的

首先拖出三个text,再拖出4个Command按钮 caption分别为+ - * / 这样就准备就绪了

先讲一下简单用法,第一纤森个text是第一个加数/被减数虚竖悔/因数/被除数,而第二个text是第二个加数/减数/因数/除数,第三个text是和/差/积/商,在text1输入一个数,text2输入一个,然后分别点击command“+ - * /”text3就差正会出现结果

然后随便单击一个窗口,把里面的文字删去,再写上:

Private Sub Command1_Click()

Text3.Text = Str$(Val(Text1.Text) + Val(Text2.Text))

End Sub

Private Sub Command2_Click()

Text3.Text = Str$(Val(Text1.Text) - Val(Text2.Text))

End Sub

Private Sub Command3_Click()

Text3.Text = Str$(Val(Text1.Text) * Val(Text2.Text))

End Sub

Private Sub Command4_Click()

Text3.Text = Str$(Val(Text1.Text) / Val(Text2.Text))

End Sub

然后运行,应该就可以了

怎么用vb做一个电费的计算器?

在窗体上添加一个Text1控件, 用于输入电费单价;再添加一个Text2控件,用于输入渣局闹电量;再添加一个Text3, 用于输出计算结果;最后添加一个Command1按钮如罩。代码腊败如下:

Private Sub Command1_Click()

Text3.Text = Val(Text1.Text) * Val(Text2.Text)

End Sub


文章标题:vb点虐 怎么做计算器 vbs做计算器
网页路径:http://kswjz.com/article/ddpeeho.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流