三九宝宝网宝宝百科宝宝知识

vb编辑简单计算器的代码

03月28日 编辑 39baobao.com

[c++实现计算器的方法和代码]中缀表达式转后缀表达式,考试大现在就用这个方式再实现计算器..表达式一旦转换成后缀表达式再进行计算就简单的不得了.Examda遇到一个符号就弹出离他最近的两个操作数然后...+阅读

Text1 计算数字

Text2 计算数字2

Label1 符号 + - * ÷

Text3 答案

代码-----------------------------------------------------------------------------------------------------------------

If Label1.Caption = "-" Then Text3.Text = Val(Text1.Text) - Text2.Text

If Label1.Caption = "+" Then Text3.Text = Val(Text1.Text) + Text2.Text

If Label1.Caption = "÷" Then Text3.Text = Val(Text1.Text) / Text2.Text

If Label1.Caption = "*" Then Text3.Text = Val(Text1.Text) * Text2.Text

求vb计算器代码及简单界面

Private Sub Command1_Click() MsgBox Val(Text1) + Val(text2) End Sub Private Sub Command2_Click() MsgBox Val(Text1) - Val(text2) End Sub Private Sub Command3_Click() MsgBox Val(Text1) * Val(text2) End Sub Private Sub Command4_Click() If text2 = 0 Then MsgBox "除数不为0" Else MsgBox Val(Text1) / Val(text2) End If End Sub

VB计算器代码?

我这有一个简单的计算机代码

结构如下:

代码:

Dim index Private Sub Command1_Click() index = "+" End Sub

Private Sub Command2_Click() index = "-" End Sub

Private Sub Command3_Click() index = "*" End Sub

Private Sub Command4_Click() index = "/" End Sub

Private Sub Command5_Click() Select Case index Case "+" Text3.Text = Val(Text1.Text) + Val(Text2.Text) Case "-" Text3.Text = Val(Text1.Text) - Val(Text2.Text) Case "*" Text3.Text = Val(Text1.Text) * Val(Text2.Text) Case "/" Text3.Text = Val(Text1.Text) / Val(Text2.Text) End Select End Sub

Private Sub Command6_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" End Sub

楼主给分哦!

用VB制作一个简单的计算器求他的代码最好是全部的代码也可

Option Explicit

Dim a, b, c As Single, j As Integer, k As Boolean

Private Sub cls_Click()

xs.Text = ""

dot.Enabled = True

a = 0

End Sub

Private Sub dot_Click()

If k Then k = False: xs.Text = "0"

xs.Text = xs.Text + "."

dot.Enabled = False

End Sub

Private Sub dy_Click()

k = True

b = Val(xs.Text)

Select Case j

Case 0

c = a + b

Case 1

c = a - b

Case 2

c = a * b

Case 3

If b <> 0 Then c = a / b

Case 4

If b <> 0 Then c = a Mod b

End Select

xs.Text = c

End Sub

Private Sub exit_Click()

Unload Me

Form1.Show

End Sub

Private Sub Form_Load()

k = False

End Sub

Private Sub js_Click(Index As Integer)

k = True

a = Val(xs.Text)

j = Index

dot.Enabled = True

End Sub

Private Sub num_Click(Index As Integer)

If k Then k = False: xs.Text = "0"

xs.Text = xs.Text & CStr(Index)

End Sub

Private Sub xs_Change()

If Len(xs.Text) = 2 And Left(xs.Text, 1) = "0" And Right(xs.Text, 1) <> "." Then xs.Text = Right(xs.Text, 1)

End Sub

以下为关联文档:

编辑视频最简单的软件我赞同楼上的会会(会声会影),可以安装免费的,放心。 下面是百科: 会声会影主要的特点是:操作简单,适合家庭日常使用,完整的影片编辑流程解决方案、从拍摄到分享、新增处理速度加倍。...

vb编程主要是如何判断闰年的代码Private Sub Command1_Click() dim y as integer y = int(val(text1.text)) if y mod 4 = 0 then if y mod 100=0 then if y mod 400=0 then text2.text=text1.text + "是闰...

判断是否闰年的vb代码1 2 3 4 5 6 7 8 9 10 11 12 Subs() y = Val(InputBox("请输入年份:")) Ify Mod4 Then GoTo100 ElseIf(y Mod100) = 0 Then Ify Mod400 ThenGoTo100 EndIf MsgBox y & "年是闰年!" Ex...

请教html计算器代码作为初学者,必须养成模块化思想和错误处理习惯。简单的代码写在下面。 _________ <html> <head> <title&gt;简单的计算器代码</title> </head> <body> <h1&gt;计算器</h1> 输入...

VB输入年份得到星期代码Private Sub Cmd1_Click()Dim c As IntegerDim y As Integer, m As Integer, d As IntegerDim w As Integerc = CInt(Text1.Text) \ 100y = CInt(Text1.Text) Mod 100m = CI...

VB程序代码时钟指针的相关代码求指教Const y0& = 1110, x0& = 1100, radius& = 750 【这一句看不懂】 'Const 是自定义常量的修饰符,Const y0& = 1110 等价于 Const y0 as long = 1110, &是long类型的简易表达 '...

用vb编辑倒计时怎么弄窗体上添加一个timer控件,一个label控件,代码窗体里的代码: Dim ts As Integer '全局变量 Private Sub Form_Load() ts = 60 Timer1.Interval = 1000 '1s执行一次 Timer1.Enabl...

vb中如何通过代码创建控件Option Explicit Private WithEvents NewButton As CommandButton '通过使用WithEvents关键字声明一个对象变量为新的命令按钮 Private Sub Command1_Click() If NewButton...

Excel 2007 VBA代码编辑求教Sub 可儿() Dim lngR As Long '以下这一条适用于2007版,请根据需要启用其中一条 lngR = Range("B1048576").End(xlUp).Row '以下这一条适用于2003版,请根据需要启用其中一条 'lngR...

推荐阅读
图文推荐