用VB编写计算器的代码如何写

用VB编写计算器的代码如何写,第1张

在窗体上放置以下控件:

1、lblResult

Label控件

设置lblResultCaption

=

0

2、btnNum(0)~btnNum(9)

按钮控件数组,下标对应齐数字(如:btnNum(0)Caption=0,依次类推)

3、添加btnAdd(加法)、btnSub(减法)、btnMul(乘法)、btnDiv(除法)、btnEnter(等于号)、btnReset(清除键)六个按钮。

在窗体代码中输入以下内容:

Dim

byteOperation

As

Byte

' *** 作符

Dim

byteTmp

As

Byte

'临时 *** 作符

Dim

intNum

As

Double

'输入的数字

Sub

Calc()

Select

Case

byteOperation

Case

1

'Add

lblResultCaption

=

CDbl(lblResultCaption)

+

intNum

Case

2

'Sub

lblResultCaption

=

intNum

-

CDbl(lblResultCaption)

Case

3

'Mul

lblResultCaption

=

CDbl(lblResultCaption)

intNum

Case

4

'Div

lblResultCaption

=

intNum

/

CDbl(lblResultCaption)

Case

Else

End

Select

End

Sub

Private

Sub

btnNum_Click(Index

As

Integer)

If

byteTmp

<>

0

Then

intNum

=

lblResultCaption

lblResultCaption

=

0

byteTmp

=

0

End

If

If

lblResultCaption

=

0

Then

lblResultCaption

=

Index

Else

If

Len(lblResultCaption)

<

9

Then

lblResultCaption

=

lblResultCaption

&

Index

End

If

End

If

End

Sub

Private

Sub

btnAdd_Click()

If

byteOperation

<>

0

Then

Call

Calc

End

If

byteOperation

=

1

byteTmp

=

1

End

Sub

Private

Sub

btnReset_Click()

byteTmp

=

0

byteOperation

=

0

intNum

=

0

lblResultCaption

=

0

End

Sub

Private

Sub

btnSub_Click()

If

byteOperation

<>

0

Then

Call

Calc

End

If

byteOperation

=

2

byteTmp

=

2

End

Sub

Private

Sub

btnMul_Click()

If

byteOperation

<>

0

Then

Call

Calc

End

If

byteOperation

=

3

byteTmp

=

3

End

Sub

Private

Sub

btnDiv_Click()

If

byteOperation

<>

0

Then

Call

Calc

End

If

byteOperation

=

4

byteTmp

=

4

End

Sub

Private

Sub

btnEnter_Click()

Call

Calc

byteTmp

=

0

End

Sub

初学做的不好 见谅 !!

如下

Option Explicit

Dim ClearDisplay As Boolean

Dim Operand1 As Double

Dim Operand2 As Double

Dim Operator As String

Private Sub clear_Click()

displayCaption = ""

End Sub

Private Sub dian_Click()

If InStr(displayCaption, "") Then

Exit Sub

Else

displayCaption = displayCaption + ""

End If

End Sub

Private Sub digits_Click(Index As Integer)

If ClearDisplay Then

displayCaption = ""

ClearDisplay = False

End If

displayCaption = Val(displayCaption) + digits(Index)Caption

End Sub

Private Sub display_Click()

End Sub

Private Sub div_Click(Index As Integer)

Operand1 = Val(displayCaption)

Operator = "/"

ClearDisplay = True

End Sub

Private Sub interface_Click(Index As Integer)

Dim result As Double

Operand2 = Val(displayCaption)

If Operator = "+" Then result = Operand1 + Operand2

If Operator = "-" Then result = Operand1 - Operand2

If Operator = "" Then result = Operand1 Operand2

If Operator = "/" And Operand2 <> 0 Then result = Operand1 / Operand2

displayCaption = result

ClearDisplay = True

End Sub

Private Sub minnus_Click(Index As Integer)

Operand1 = Val(displayCaption)

Operator = "-"

ClearDisplay = True

End Sub

Private Sub over_Click()

If Val(displayCaption) <> 0 Then displayCaption = 1 / Val(displayCaption)

ClearDisplay = True

End Sub

Private Sub plus_Click(Index As Integer)

Operand1 = Val(displayCaption)

Operator = "+"

ClearDisplay = True

End Sub

Private Sub positive_Click(Index As Integer)

displayCaption = -Val(displayCaption)

ClearDisplay = True

End Sub

Private Sub timer_Click(Index As Integer)

Operand1 = Val(displayCaption)

Operator = ""

ClearDisplay = True

End Sub

'这个很简单的了,你用记事本把这段代码复制过去,然后另存为frm就可以了

'然后用vb打开。看看效果。

'以下保存为 任务名称frm

VERSION 500

Begin VBForm Form1

Caption = "计算机"

ClientHeight = 4230

ClientLeft = 60

ClientTop = 750

ClientWidth = 3165

LinkTopic = "Form1"

MaxButton = 0 'False

MinButton = 0 'False

ScaleHeight = 4230

ScaleWidth = 3165

StartUpPosition = 2 '屏幕中心

Begin VBFrame Frame1

Height = 3495

Left = 120

TabIndex = 1

Top = 600

Width = 2895

Begin VBCommandButton cmdResult

Caption = "="

BeginProperty Font

Name = "宋体"

Size = 12

Charset = 134

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

Height = 375

Left = 1080

TabIndex = 20

Top = 3000

Width = 1695

End

Begin VBCommandButton cmdOff

Caption = "OFF"

Height = 375

Left = 1560

TabIndex = 19

Top = 240

Width = 495

End

Begin VBCommandButton cmdCE

Caption = "CE"

Height = 375

Left = 2280

TabIndex = 18

Top = 240

Width = 495

End

Begin VBCommandButton cmdchu

Caption = "/"

Height = 375

Left = 2280

TabIndex = 17

Top = 2520

Width = 495

End

Begin VBCommandButton cmdjia

Caption = "+"

Height = 375

Left = 2280

TabIndex = 16

Top = 720

Width = 495

End

Begin VBCommandButton cmd0

Caption = "0"

Height = 375

Left = 840

TabIndex = 15

Top = 2520

Width = 495

End

Begin VBCommandButton cmd6

Caption = "6"

Height = 375

Left = 1560

TabIndex = 14

Top = 1320

Width = 495

End

Begin VBCommandButton cmd8

Caption = "8"

Height = 375

Left = 840

TabIndex = 13

Top = 720

Width = 495

End

Begin VBCommandButton cmd4

Caption = "4"

Height = 375

Left = 120

TabIndex = 12

Top = 1320

Width = 495

End

Begin VBCommandButton cmd9

Caption = "9"

Height = 375

Left = 1560

TabIndex = 11

Top = 720

Width = 495

End

Begin VBCommandButton cmd2

Caption = "2"

Height = 375

Left = 840

TabIndex = 10

Top = 1920

Width = 495

End

Begin VBCommandButton cmdjian

Caption = "-"

Height = 375

Left = 2280

TabIndex = 9

Top = 1320

Width = 495

End

Begin VBCommandButton cmdPoint

Caption = ""

BeginProperty Font

Name = "宋体"

Size = 12

Charset = 134

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

Height = 375

Left = 1560

TabIndex = 8

Top = 2520

Width = 495

End

Begin VBCommandButton cmdcheng

Caption = ""

Height = 375

Left = 2280

TabIndex = 7

Top = 1920

Width = 495

End

Begin VBCommandButton cmd5

Caption = "5"

Height = 375

Left = 840

TabIndex = 6

Top = 1320

Width = 495

End

Begin VBCommandButton cmd3

Caption = "3"

Height = 375

Left = 1560

TabIndex = 5

Top = 1905

Width = 495

End

Begin VBCommandButton cmd1

Caption = "1"

Height = 375

Left = 120

TabIndex = 4

Top = 1920

Width = 495

End

Begin VBCommandButton cmd7

Caption = "7"

Height = 375

Left = 120

TabIndex = 3

Top = 720

Width = 495

End

Begin VBCommandButton cmdChange

Caption = "+/-"

Height = 375

Left = 120

TabIndex = 2

Top = 2520

Width = 495

End

End

Begin VBTextBox txt

Alignment = 1 'Right Justify

Enabled = 0 'False

BeginProperty Font

Name = "宋体"

Size = 105

Charset = 134

Weight = 400

Underline = 0 'False

Italic = 0 'False

Strikethrough = 0 'False

EndProperty

Height = 375

Left = 120

Locked = -1 'True

TabIndex = 0

Top = 120

Width = 2895

End

Begin VBMenu meuFile

Caption = "文件(&F)"

Begin VBMenu meuExit

Caption = "退出(&X)"

Shortcut = ^X

End

End

End

Attribute VB_Name = "Form1"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Dim XiaoShu As Boolean

'在窗体变量中声明一个布尔值来判断是否按下小数点键,防止txt中出现多个小数。如果已经输入了小数点则Xiaoshu为True,否则为False

Dim FuHao As Byte

'声明一个Byte来记录我们按下了什么符号,1为"+",2为"-",3为"",4为"/"

Dim FirstNumber As Double

'声明一个变量来记录 *** 作数的第一个数,如A+B,那么FirstNumber来记下A的值。

Dim DengHao As Boolean

'声明一个变量来记录是否按下了=号,如果按下了则为True

Private Sub cmd0_Click()

If txtText <> "" Then txtText = txtText + "0" '防止多个0在文本中出现

End Sub

Private Sub cmd1_Click() '按下1时

If Not DengHao Then '没按下等号

txtText = txtText + "1"

Else

txtText = "1" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd2_Click() '按下2时

If Not DengHao Then '没按下等号

txtText = txtText + "2"

Else

txtText = "2" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd3_click() '按下3时

If Not DengHao Then '没按下等号

txtText = txtText + "3"

Else

txtText = "3" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd4_Click() '按下4时

If Not DengHao Then '没按下等号

txtText = txtText + "4"

Else

txtText = "4" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd5_Click() '按下5时

If Not DengHao Then '没按下等号

txtText = txtText + "5"

Else

txtText = "5" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd6_Click() '按下6时

If Not DengHao Then '没按下等号

txtText = txtText + "6"

Else

txtText = "6" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd7_Click() '按下7时

If Not DengHao Then '没按下等号

txtText = txtText + "7"

Else

txtText = "7" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd8_Click() '按下8时

If Not DengHao Then '没按下等号

txtText = txtText + "8"

Else

txtText = "8" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmd9_Click() '按下9时

If Not DengHao Then '没按下等号

txtText = txtText + "9"

Else

txtText = "9" '按下了等号

DengHao = False

End If

End Sub

Private Sub cmdCE_Click()

txtText = ""

XiaoShu = False

End Sub

Private Sub cmdChange_Click()

If (Sgn(Val(txtText))) = 1 Then txtText = "-" + txtText: Exit Sub '用Sgn来判断txt文本框内的值的符号。大于0的话就在前面加上"-"

If (Sgn(Val(txtText))) = -1 Then txtText = Abs(Val(txtText)) 'txt文本框的文本为大于0的数txt前面的"-"去掉。

End Sub

Private Sub cmdcheng_Click()

FirstNumber = Val(txtText)

FuHao = 3

txtText = ""

XiaoShu = False

End Sub

Private Sub cmdchu_Click()

FirstNumber = Val(txtText)

FuHao = 4

txtText = ""

XiaoShu = False

End Sub

Private Sub cmdjia_Click()

FirstNumber = Val(txtText)

FuHao = 1

txtText = ""

XiaoShu = False

End Sub

Private Sub cmdjian_Click()

FirstNumber = Val(txtText)

FuHao = 2

txtText = ""

XiaoShu = False

End Sub

Private Sub cmdOff_Click()

End

End Sub

Private Sub cmdPoint_Click()

If txtText = "" Then txtText = "0"

If Not XiaoShu Then '当我们以前没有按下小数点键时在txt中加上小数点

txtText = txtText + ""

XiaoShu = True

End If

End Sub

Private Sub cmdResult_Click()

If FuHao = 1 Then '按下了+号

txtText = FirstNumber + Val(txtText)

End If

If FuHao = 2 Then '按下了-号

txtText = FirstNumber - Val(txtText)

End If

If FuHao = 3 Then '按下了号

txtText = FirstNumber Val(txtText)

End If

If FuHao = 4 Then '按下了、号

txtText = FirstNumber / Val(txtText)

End If

DengHao = True '记录下按了=号

XiaoShu = False

End Sub

Private Sub meuExit_Click()

End

End Sub

终于编写出来了,代码如下: Option Explicit Dim strNumber As String Dim strPoint As String Dim dblNum1 As Double Dim intOperator As Integer '清除结果 Private Sub cmdGT_Click() txtDisplayText = "0" strNumber = "" strPoint = "" intOperator = 7 End Sub '输入数字 Private Sub cmdNumber_Click(Index As Integer) strNumber = strNumber & cmdNumber(Index)Caption txtDisplayText = strNumber & strPoint End Sub Private Sub cmdOnOff_Click() End End Sub '运算过程 Private Sub cmdOperator_Click(Index As Integer) Dim dblnum2 As Double '是第一次单击运算符时,将输入的值先赋给第一个数,否则赋值给第二个数进行运算 If intOperator = 7 Then dblNum1 = CDbl(txtDisplayText) Else dblnum2 = CDbl(Val(txtDisplayText)) '根据输入的符号进行运算 '求普通运算 Select Case intOperator Case 0 dblNum1 = dblNum1 + dblnum2 Case 1 dblNum1 = dblNum1 - dblnum2 Case 2 dblNum1 = dblNum1 dblnum2 Case 3 If dblnum2 <> 0 Then dblNum1 = dblNum1 / dblnum2 Else MsgBox "除数不能为“0”!请重新输入除数。", vbOKOnly + vbInformation, "除零错误" Index = intOperator End If Case 6 dblNum1 = dblNum1 dblnum2 / 100 End Select End If '取得当前输入的运算符,以做下次运算 intOperator = Index strNumber = "" txtDisplay = CStr(dblNum1) '判断是否为文本框中的数字加点 If Not txtDisplay Like "" Then txtDisplayText = txtDisplayText & "" End If End Sub Private Sub cmdOtherOper_Click(Index As Integer) Dim dblNum As Double '求平方根,平方, dblNum = CDbl(Val(txtDisplayText)) Select Case Index Case 0 '验证数据是否有效 If dblNum >= 0 Then txtDisplayText = CStr(Sqr(dblNum)) Else MsgBox "负数不能开平方根!", _ vbOKOnly + vbCritical, "开平方根错误" End If Case 1 txtDisplayText = CStr(dblNum ^ 2) End Select '判断是否为文本框中的数字加点 If Not txtDisplay Like "" Then txtDisplayText = txtDisplayText & "" End If End Sub Private Sub cmdPoint_Click() strNumber = strNumber & strPoint strPoint = "" End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) '使被按下的数字键的对应按钮取得焦点 Select Case KeyCode Case 48 To 57 cmdNumber(KeyCode - 48)SetFocus Case 96 To 105 cmdNumber(KeyCode - 96)SetFocus Case Else '使按下的符号键对应的按钮取得焦点 If KeyCode = 107 Or (Shift = vbShiftMask And KeyCode = 187) Then cmdOperator(0)SetFocus cmdOperator_Click (0) ElseIf KeyCode = 109 Or KeyCode = 189 Then cmdOperator(1)SetFocus cmdOperator_Click (1) ElseIf KeyCode = 106 Or (Shift = vbShiftMask And KeyCode = 56) Then cmdOperator(2)SetFocus cmdOperator_Click (2) ElseIf KeyCode = 111 Or KeyCode = 191 Then cmdOperator(3)SetFocus cmdOperator_Click (3) ElseIf KeyCode = 13 Then cmdOperator(7)SetFocus cmdOperator_Click (7) ElseIf KeyCode = 8 Then cmdGTSetFocus Call cmdGT_Click End If End Select End Sub Private Sub Form_KeyPress(KeyAscii As Integer) '将合法的数据输入到文本框 Select Case KeyAscii Case 48 To 58 '调用数字键点击处理程序 cmdNumber_Click KeyAscii - 48 KeyAscii = 0 Case 46 '调用小数点输入 cmdPoint_Click KeyAscii = 0 Case 13 '当敲击回车时,不能触发Form的 KeyUp 事件,因此在这里设置文本框的焦点 txtDisplaySetFocus Case Else KeyAscii = 0 End Select End Sub Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) txtDisplaySetFocus End Sub Private Sub Form_Load() strNumber = "" strPoint = "" intOperator = 7 End Sub

分类: 电脑/网络 >> 程序设计 >> 其他编程语言

问题描述:

不用很复杂的,只要能实现一般的加减乘除就行了.急啊!!

高手请多帮忙

解析:

Dim num1, num2 As Double

Dim a1, a2, a3 As Integer

Private Sub add_Click()

a2 = 1

If a3 = 0 Then

num2 = num1

End If

a1 = 10

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

num1 = 0

a3 = 0

End Sub

Private Sub cls_Click()

num1 = 0

num2 = 0

a1 = 10

a2 = 0

a3 = 0

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

End Sub

Private Sub div_Click()

a2 = 4

If a3 = 0 Then

num2 = num1

End If

a1 = 10

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

num1 = 0

a3 = 0

End Sub

Private Sub equ_Click()

Select Case a2

Case 1

num2 = num1 + num2

Case 2

num2 = num2 - num1

Case 3

num2 = num2 num1

Case 4

num2 = num2 / num1

End Select

labdisCaption = Str$(num2)

If num2 < 1 And num2 > 0 Then

labdisCaption = "0" + Mid$(Str$(num2), 2)

End If

If num2 < 0 And num2 > -1 Then

labdisCaption = "-0" + Mid$(Str$(num2), 2)

End If

equEnabled = False

a2 = 0

addEnabled = True

subEnabled = True

mulEnabled = True

divEnabled = True

poiEnabled = False

num1 = 0

a3 = 1

a1 = 10

End Sub

Private Sub mul_Click()

a2 = 3

If a3 = 0 Then

num2 = num1

End If

a1 = 10

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

num1 = 0

a3 = 0

End Sub

Private Sub num0_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "0"

If a1 <> 10 Then

num1 = num1 + a1 0

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 0

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

If a2 = 4 And num1 = 0 Then

equEnabled = False

End If

End Sub

Private Sub num1_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "1"

If a1 <> 10 Then

num1 = num1 + a1 1

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 1

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num2_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "2"

If a1 <> 10 Then

num1 = num1 + a1 2

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 2

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num3_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "3"

If a1 <> 10 Then

num1 = num1 + a1 3

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 3

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num4_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "4"

If a1 <> 10 Then

num1 = num1 + a1 4

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 4

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num5_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "5"

If a1 <> 10 Then

num1 = num1 + a1 5

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 5

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num6_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "6"

If a1 <> 10 Then

num1 = num1 + a1 6

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 6

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num7_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "7"

If a1 <> 10 Then

num1 = num1 + a1 7

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 7

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num8_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "8"

If a1 <> 10 Then

num1 = num1 + a1 8

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 8

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub num9_Click()

If a3 = 1 Then

labdisCaption = ""

a3 = 0

poiEnabled = True

End If

labdisCaption = labdisCaption + "9"

If a1 <> 10 Then

num1 = num1 + a1 9

a1 = a1 / 10

Else

poiEnabled = True

num1 = num1 a1 + 9

End If

If a2 = 0 Then

addEnabled = True

mulEnabled = True

subEnabled = True

divEnabled = True

Else

equEnabled = True

End If

End Sub

Private Sub off_Click()

Unload Me

End Sub

Private Sub poi_Click()

a1 = 01

poiEnabled = False

labdisCaption = labdisCaption + ""

equEnabled = False

addEnabled = False

mulEnabled = False

subEnabled = False

divEnabled = False

End Sub

Private Sub sub_Click()

a2 = 2

If a3 = 0 Then

num2 = num1

End If

a1 = 10

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

num1 = 0

a3 = 0

End Sub

Private Sub Form_Load()

num1 = 0

num2 = 0

a1 = 10

a2 = 0

a3 = 0

labdisCaption = ""

addEnabled = False

subEnabled = False

mulEnabled = False

divEnabled = False

poiEnabled = False

End Sub

以上就是关于用VB编写计算器的代码如何写全部的内容,包括:用VB编写计算器的代码如何写、如何使用VB编写简单计算器、用VB设计一个计算器等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10044145.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-04
下一篇2023-05-04

发表评论

登录后才能评论

评论列表(0条)

    保存