vb.net简易计算器,vbnet计算器程序

如何用vb.net编写一个简单的计算器程序啊?多谢啊

你自己加窗体和空件吧

创新互联建站是专业的信丰网站建设公司,信丰接单;提供成都网站制作、成都网站建设、外贸营销网站建设,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行信丰网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

Private Sub a1_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X + Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a2_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X - Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a3_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X * Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a4_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X / Y

Text3.Text = s

Text3.Locked = True

End Sub

不会的叫我 在线谈

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 = 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.net制作计算器的问题

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

如何用VB.NET编写计算器

简单的说拖出一些控件,设置相应的caption和属性等等,双击每个button控件,进行相应的处理,即可

在VB.net中,怎么编一个计算器,要求输入 1+2*3输出7。

Dim Scr As Object

Scr = CreateObject("MSScriptControl.ScriptControl")

Scr.Language = "Vbscript"

Dim t As Single

t = Scr.Eval(TextBox1.Text)

MsgBox(t)


分享文章:vb.net简易计算器,vbnet计算器程序
网址分享:http://ybzwz.com/article/dsidggh.html