fatima zero
Posts: 5
Nickname: phantomeya
Registered: Oct, 2005
|
|
Re: code for windows calculator using vb.net
|
Posted: Nov 7, 2005 2:25 PM
|
|
Public Class calculator Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents txtAcceptNumber As System.Windows.Forms.TextBox Friend WithEvents Button11 As System.Windows.Forms.Button Friend WithEvents Button14 As System.Windows.Forms.Button Friend WithEvents Button15 As System.Windows.Forms.Button Friend WithEvents Button16 As System.Windows.Forms.Button Friend WithEvents Button22 As System.Windows.Forms.Button Friend WithEvents Button24 As System.Windows.Forms.Button Friend WithEvents Button25 As System.Windows.Forms.Button Friend WithEvents Button26 As System.Windows.Forms.Button Friend WithEvents Button27 As System.Windows.Forms.Button Friend WithEvents btn8 As System.Windows.Forms.Button Friend WithEvents btn9 As System.Windows.Forms.Button Friend WithEvents btn5 As System.Windows.Forms.Button Friend WithEvents btn6 As System.Windows.Forms.Button Friend WithEvents btn2 As System.Windows.Forms.Button Friend WithEvents btn3 As System.Windows.Forms.Button Friend WithEvents btn0 As System.Windows.Forms.Button Friend WithEvents btn7 As System.Windows.Forms.Button Friend WithEvents btn4 As System.Windows.Forms.Button Friend WithEvents btn1 As System.Windows.Forms.Button Friend WithEvents btnpoint As System.Windows.Forms.Button Friend WithEvents btnplus As System.Windows.Forms.Button Friend WithEvents btnminus As System.Windows.Forms.Button Friend WithEvents btndivide As System.Windows.Forms.Button Friend WithEvents btnMulty As System.Windows.Forms.Button Friend WithEvents btnequal As System.Windows.Forms.Button Friend WithEvents btnclear As System.Windows.Forms.Button Friend WithEvents btnback As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(calculator)) Me.btnequal = New System.Windows.Forms.Button Me.txtAcceptNumber = New System.Windows.Forms.TextBox Me.btn8 = New System.Windows.Forms.Button Me.btn9 = New System.Windows.Forms.Button Me.btndivide = New System.Windows.Forms.Button Me.btn5 = New System.Windows.Forms.Button Me.btn6 = New System.Windows.Forms.Button Me.btnMulty = New System.Windows.Forms.Button Me.btn2 = New System.Windows.Forms.Button Me.btn3 = New System.Windows.Forms.Button Me.btnminus = New System.Windows.Forms.Button Me.Button11 = New System.Windows.Forms.Button Me.btnpoint = New System.Windows.Forms.Button Me.btnplus = New System.Windows.Forms.Button Me.Button14 = New System.Windows.Forms.Button Me.Button15 = New System.Windows.Forms.Button Me.Button16 = New System.Windows.Forms.Button Me.btn0 = New System.Windows.Forms.Button Me.btn7 = New System.Windows.Forms.Button Me.btn4 = New System.Windows.Forms.Button Me.btn1 = New System.Windows.Forms.Button Me.btnback = New System.Windows.Forms.Button Me.Button22 = New System.Windows.Forms.Button Me.btnclear = New System.Windows.Forms.Button Me.Button24 = New System.Windows.Forms.Button Me.Button25 = New System.Windows.Forms.Button Me.Button26 = New System.Windows.Forms.Button Me.Button27 = New System.Windows.Forms.Button Me.SuspendLayout() ' 'btnequal ' Me.btnequal.BackColor = System.Drawing.Color.White Me.btnequal.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnequal.Location = New System.Drawing.Point(296, 240) Me.btnequal.Name = "btnequal" Me.btnequal.Size = New System.Drawing.Size(48, 32) Me.btnequal.TabIndex = 0 Me.btnequal.Text = "=" ' 'txtAcceptNumber ' Me.txtAcceptNumber.Location = New System.Drawing.Point(8, 32) Me.txtAcceptNumber.Name = "txtAcceptNumber" Me.txtAcceptNumber.Size = New System.Drawing.Size(328, 20) Me.txtAcceptNumber.TabIndex = 1 Me.txtAcceptNumber.Text = "" ' 'btn8 ' Me.btn8.BackColor = System.Drawing.Color.White Me.btn8.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn8.Location = New System.Drawing.Point(128, 120) Me.btn8.Name = "btn8" Me.btn8.Size = New System.Drawing.Size(48, 32) Me.btn8.TabIndex = 2 Me.btn8.Text = "8" ' 'btn9 ' Me.btn9.BackColor = System.Drawing.Color.White Me.btn9.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn9.Location = New System.Drawing.Point(184, 120) Me.btn9.Name = "btn9" Me.btn9.Size = New System.Drawing.Size(48, 32) Me.btn9.TabIndex = 3 Me.btn9.Text = "9" ' 'btndivide ' Me.btndivide.BackColor = System.Drawing.Color.White Me.btndivide.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btndivide.Location = New System.Drawing.Point(240, 120) Me.btndivide.Name = "btndivide" Me.btndivide.Size = New System.Drawing.Size(48, 32) Me.btndivide.TabIndex = 4 Me.btndivide.Text = "/" ' 'btn5 ' Me.btn5.BackColor = System.Drawing.Color.White Me.btn5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn5.Location = New System.Drawing.Point(128, 160) Me.btn5.Name = "btn5" Me.btn5.Size = New System.Drawing.Size(48, 32) Me.btn5.TabIndex = 5 Me.btn5.Text = "5" ' 'btn6 ' Me.btn6.BackColor = System.Drawing.Color.White Me.btn6.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn6.Location = New System.Drawing.Point(184, 160) Me.btn6.Name = "btn6" Me.btn6.Size = New System.Drawing.Size(48, 32) Me.btn6.TabIndex = 6 Me.btn6.Text = "6" ' 'btnMulty ' Me.btnMulty.BackColor = System.Drawing.Color.White Me.btnMulty.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnMulty.Location = New System.Drawing.Point(240, 160) Me.btnMulty.Name = "btnMulty" Me.btnMulty.Size = New System.Drawing.Size(48, 32) Me.btnMulty.TabIndex = 7 Me.btnMulty.Text = "*" ' 'btn2 ' Me.btn2.BackColor = System.Drawing.Color.White Me.btn2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn2.Location = New System.Drawing.Point(128, 200) Me.btn2.Name = "btn2" Me.btn2.Size = New System.Drawing.Size(48, 32) Me.btn2.TabIndex = 8 Me.btn2.Text = "2" ' 'btn3 ' Me.btn3.BackColor = System.Drawing.Color.White Me.btn3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn3.Location = New System.Drawing.Point(184, 200) Me.btn3.Name = "btn3" Me.btn3.Size = New System.Drawing.Size(48, 32) Me.btn3.TabIndex = 9 Me.btn3.Text = "3" ' 'btnminus ' Me.btnminus.BackColor = System.Drawing.Color.White Me.btnminus.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnminus.Location = New System.Drawing.Point(240, 200) Me.btnminus.Name = "btnminus" Me.btnminus.Size = New System.Drawing.Size(48, 32) Me.btnminus.TabIndex = 10 Me.btnminus.Text = "-" ' 'Button11 ' Me.Button11.BackColor = System.Drawing.Color.White Me.Button11.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button11.Location = New System.Drawing.Point(128, 240) Me.Button11.Name = "Button11" Me.Button11.Size = New System.Drawing.Size(48, 32) Me.Button11.TabIndex = 11 Me.Button11.Text = "+/-" ' 'btnpoint ' Me.btnpoint.BackColor = System.Drawing.Color.White Me.btnpoint.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnpoint.Location = New System.Drawing.Point(184, 240) Me.btnpoint.Name = "btnpoint" Me.btnpoint.Size = New System.Drawing.Size(48, 32) Me.btnpoint.TabIndex = 12 Me.btnpoint.Text = "." ' 'btnplus ' Me.btnplus.BackColor = System.Drawing.Color.White Me.btnplus.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnplus.Location = New System.Drawing.Point(240, 240) Me.btnplus.Name = "btnplus" Me.btnplus.Size = New System.Drawing.Size(48, 32) Me.btnplus.TabIndex = 13 Me.btnplus.Text = "+" ' 'Button14 ' Me.Button14.BackColor = System.Drawing.Color.White Me.Button14.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button14.Location = New System.Drawing.Point(296, 120) Me.Button14.Name = "Button14" Me.Button14.Size = New System.Drawing.Size(48, 32) Me.Button14.TabIndex = 14 Me.Button14.Text = "sqrt" ' 'Button15 ' Me.Button15.BackColor = System.Drawing.Color.White Me.Button15.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button15.Location = New System.Drawing.Point(296, 160) Me.Button15.Name = "Button15" Me.Button15.Size = New System.Drawing.Size(48, 32) Me.Button15.TabIndex = 15 Me.Button15.Text = "%" ' 'Button16 ' Me.Button16.BackColor = System.Drawing.Color.White Me.Button16.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button16.Location = New System.Drawing.Point(296, 200) Me.Button16.Name = "Button16" Me.Button16.Size = New System.Drawing.Size(48, 32) Me.Button16.TabIndex = 16 Me.Button16.Text = "1/x" ' 'btn0 ' Me.btn0.BackColor = System.Drawing.Color.White Me.btn0.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn0.Location = New System.Drawing.Point(72, 240) Me.btn0.Name = "btn0" Me.btn0.Size = New System.Drawing.Size(48, 32) Me.btn0.TabIndex = 17 Me.btn0.Text = "0" ' 'btn7 ' Me.btn7.BackColor = System.Drawing.Color.White Me.btn7.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn7.Location = New System.Drawing.Point(72, 120) Me.btn7.Name = "btn7" Me.btn7.Size = New System.Drawing.Size(48, 32) Me.btn7.TabIndex = 18 Me.btn7.Text = "7" ' 'btn4 ' Me.btn4.BackColor = System.Drawing.Color.White Me.btn4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn4.Location = New System.Drawing.Point(72, 160) Me.btn4.Name = "btn4" Me.btn4.Size = New System.Drawing.Size(48, 32) Me.btn4.TabIndex = 19 Me.btn4.Text = "4" ' 'btn1 ' Me.btn1.BackColor = System.Drawing.Color.White Me.btn1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btn1.Location = New System.Drawing.Point(72, 200) Me.btn1.Name = "btn1" Me.btn1.Size = New System.Drawing.Size(48, 32) Me.btn1.TabIndex = 20 Me.btn1.Text = "1" ' 'btnback ' Me.btnback.BackColor = System.Drawing.Color.White Me.btnback.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnback.Location = New System.Drawing.Point(72, 80) Me.btnback.Name = "btnback" Me.btnback.Size = New System.Drawing.Size(80, 24) Me.btnback.TabIndex = 21 Me.btnback.Text = "backspace" ' 'Button22 ' Me.Button22.BackColor = System.Drawing.Color.White Me.Button22.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button22.Location = New System.Drawing.Point(160, 80) Me.Button22.Name = "Button22" Me.Button22.Size = New System.Drawing.Size(80, 24) Me.Button22.TabIndex = 22 Me.Button22.Text = "CE" ' 'btnclear ' Me.btnclear.BackColor = System.Drawing.Color.White Me.btnclear.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.btnclear.Location = New System.Drawing.Point(256, 80) Me.btnclear.Name = "btnclear" Me.btnclear.Size = New System.Drawing.Size(80, 24) Me.btnclear.TabIndex = 23 Me.btnclear.Text = "C" ' 'Button24 ' Me.Button24.BackColor = System.Drawing.Color.White Me.Button24.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button24.Location = New System.Drawing.Point(8, 120) Me.Button24.Name = "Button24" Me.Button24.Size = New System.Drawing.Size(48, 32) Me.Button24.TabIndex = 24 Me.Button24.Text = "MC" ' 'Button25 ' Me.Button25.BackColor = System.Drawing.Color.White Me.Button25.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button25.Location = New System.Drawing.Point(8, 160) Me.Button25.Name = "Button25" Me.Button25.Size = New System.Drawing.Size(48, 32) Me.Button25.TabIndex = 25 Me.Button25.Text = "MR" ' 'Button26 ' Me.Button26.BackColor = System.Drawing.Color.White Me.Button26.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button26.Location = New System.Drawing.Point(8, 200) Me.Button26.Name = "Button26" Me.Button26.Size = New System.Drawing.Size(48, 32) Me.Button26.TabIndex = 26 Me.Button26.Text = "MS" ' 'Button27 ' Me.Button27.BackColor = System.Drawing.Color.White Me.Button27.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(178, Byte)) Me.Button27.Location = New System.Drawing.Point(8, 240) Me.Button27.Name = "Button27" Me.Button27.Size = New System.Drawing.Size(48, 32) Me.Button27.TabIndex = 27 Me.Button27.Text = "M+" ' 'calculator ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.Color.PeachPuff Me.ClientSize = New System.Drawing.Size(352, 286) Me.Controls.Add(Me.Button27) Me.Controls.Add(Me.Button26) Me.Controls.Add(Me.Button25) Me.Controls.Add(Me.Button24) Me.Controls.Add(Me.btnclear) Me.Controls.Add(Me.Button22) Me.Controls.Add(Me.btnback) Me.Controls.Add(Me.btn1) Me.Controls.Add(Me.btn4) Me.Controls.Add(Me.btn7) Me.Controls.Add(Me.btn0) Me.Controls.Add(Me.Button16) Me.Controls.Add(Me.Button15) Me.Controls.Add(Me.Button14) Me.Controls.Add(Me.btnplus) Me.Controls.Add(Me.btnpoint) Me.Controls.Add(Me.Button11) Me.Controls.Add(Me.btnminus) Me.Controls.Add(Me.btn3) Me.Controls.Add(Me.btn2) Me.Controls.Add(Me.btnMulty) Me.Controls.Add(Me.btn6) Me.Controls.Add(Me.btn5) Me.Controls.Add(Me.btndivide) Me.Controls.Add(Me.btn9) Me.Controls.Add(Me.btn8) Me.Controls.Add(Me.txtAcceptNumber) Me.Controls.Add(Me.btnequal) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Name = "calculator" Me.Text = "calculator" Me.ResumeLayout(False)
End Sub
#End Region
Dim zero As Double Dim one As Double Dim two As Double Dim three As Double Dim four As Double Dim five As Double Dim six As Double Dim seven As Double Dim eight As Double Dim nine As Double Dim plus As Double Dim save As Double Dim buttonclick As Double Dim checked As Double
Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
If checked = 1 Then txtAcceptNumber.Text = 0 'checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 0 End If End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
If checked = 1 Then txtAcceptNumber.Text = 1 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 1 End If
End Sub
Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
If checked = 1 Then txtAcceptNumber.Text = 2 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 2 End If End Sub
Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click If checked = 1 Then txtAcceptNumber.Text = 3 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 3 End If End Sub
Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
If checked = 1 Then txtAcceptNumber.Text = 4 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 4 End If End Sub
Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click If checked = 1 Then txtAcceptNumber.Text = 5 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 5 End If End Sub
Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
If checked = 1 Then txtAcceptNumber.Text = 6 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 6 End If End Sub
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
If checked = 1 Then txtAcceptNumber.Text = 7 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 7 End If End Sub
Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
If checked = 1 Then txtAcceptNumber.Text = 8 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 8 End If End Sub
Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
If checked = 1 Then txtAcceptNumber.Text = 9 checked = 0 Else Dim read As Double = txtAcceptNumber.Text txtAcceptNumber.Text = read & 9 End If End Sub
Private Sub btnpoint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpoint.Click If checked = 1 Then 'Dim d As Double = "." txtAcceptNumber.Text = "." checked = 0 Else Dim read As Double = txtAcceptNumber.Text 'Dim d As Double = "." txtAcceptNumber.Text = read & "." End If End Sub
Private Sub btnplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnplus.Click Dim read As Double = txtAcceptNumber.Text If buttonclick = 89 Then txtAcceptNumber.Text = save + read checked = 1 save = txtAcceptNumber.Text Else save = txtAcceptNumber.Text buttonclick = 89 txtAcceptNumber.Text = "0" End If
End Sub
Private Sub btnminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnminus.Click Dim read As Double = txtAcceptNumber.Text If buttonclick = 1 Then txtAcceptNumber.Text = save - read checked = 1 save = txtAcceptNumber.Text Else save = txtAcceptNumber.Text buttonclick = 1 txtAcceptNumber.Text = "0" End If End Sub
Private Sub btndivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndivide.Click Dim read As Double = txtAcceptNumber.Text If buttonclick = 2 Then txtAcceptNumber.Text = save / read checked = 1 save = txtAcceptNumber.Text Else
save = txtAcceptNumber.Text buttonclick = 2 txtAcceptNumber.Text = "0" End If End Sub
Private Sub btnMulty_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMulty.Click Dim read As Double = txtAcceptNumber.Text If buttonclick = 3 Then txtAcceptNumber.Text = save * read checked = 1 save = txtAcceptNumber.Text Else
save = txtAcceptNumber.Text buttonclick = 3 txtAcceptNumber.Text = "0" End If End Sub
Private Sub btnequal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnequal.Click Dim read As Double = txtAcceptNumber.Text If buttonclick = 89 Then txtAcceptNumber.Text = save + read checked = 1 buttonclick = 0 save = 0 ElseIf buttonclick = 1 Then txtAcceptNumber.Text = save - read checked = 1 buttonclick = 0 save = 0 ElseIf buttonclick = 2 Then txtAcceptNumber.Text = save / read checked = 1 buttonclick = 0 save = 0 ElseIf buttonclick = 3 Then txtAcceptNumber.Text = save * read checked = 1 buttonclick = 0 save = 0 End If
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click txtAcceptNumber.Text = 0 save = 0 checked = 0 'buttonclick = 0
End Sub
Private Sub btnback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnback.Click
If txtAcceptNumber.Text.Length = 1 Then
txtAcceptNumber.Text = 0 Else
Dim value1 As Double = txtAcceptNumber.Text.Length - 1 Dim val As Double = txtAcceptNumber.Text.Remove(value1, 1) txtAcceptNumber.Text = val End If
End Sub
End Class
|
|