The Artima Developer Community
Sponsored Link

Web Services Forum
code for windows calculator using vb.net

26 replies on 2 pages. Most recent reply: Mar 15, 2007 9:31 AM by Jermaine J

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 26 replies on 2 pages [ « | 1 2 ]
Dina Nass

Posts: 1
Nickname: dandoon
Registered: Nov, 2005

Re: code for windows calculator using vb.net Posted: Nov 15, 2005 3:19 AM
Reply to this message Reply
Advertisement
hi, plz i need this code asap, thanx alot
palestinianf@yahoo.co.uk

fatima zero

Posts: 5
Nickname: phantomeya
Registered: Oct, 2005

Re: code for windows calculator using vb.net Posted: Nov 16, 2005 7:53 AM
Reply to this message Reply
i have the full code so if any one wants it...email me on

fatima_zero@hotmail.com

rajiv sharma

Posts: 4
Nickname: rajsonu
Registered: Feb, 2006

Re: code for windows calculator using vb.net Posted: Feb 27, 2006 7:36 AM
Reply to this message Reply
Public Class CalcPad
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

Private Accum As Double
Private PendingOp As String
Private PendingOpFlag As Boolean

Property DisplayValue() As String
Get
Return CalcPadDisplay.Text
End Get
Set(ByVal Value As String)
End Set
End Property

Private Sub CalcPad_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
PendingOp = "Null"
PendingOpFlag = False
Accum = 0
End Sub

Private Sub op( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opplus.Click, opminus.Click, _
opdivide.Click, opmult.Click
Dim DisplayValue As Double
DisplayValue = CDec(CalcPadDisplay.Text)
If Accum = 0 Then
Accum = DisplayValue
Else
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = CStr(Accum)
End If
PendingOp = sender.tag
PendingOpFlag = True
End Sub

Private Sub opequals_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opequals.Click
CalcPadDisplay.BackColor = Color.White
If PendingOp <> "Null" Then
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = Accum
PendingOp = "Null"
PendingOpFlag = True
Accum = 0
End If
End Sub

Private Sub opclear_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opclear.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
PendingOp = "Null"
Accum = 0
End Sub

Private Sub opclearentry_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opclearentry.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
End Sub

Private Sub keyClick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles key1.Click, key2.Click, key3.Click, _
key4.Click, key5.Click, key6.Click, _
key7.Click, key8.Click, key9.Click, _
key0.Click, keydecimal.Click
CalcPadDisplay.BackColor = Color.White
If CDec(CalcPadDisplay.Text) = 0 _
Or PendingOpFlag = True Then
CalcPadDisplay.Text = sender.tag
PendingOpFlag = False
Else
CalcPadDisplay.Text &= sender.tag
End If
End Sub
Private Function AccumCalc(ByRef opcode As String)
Select Case opcode
Case "Divide"
If CDec(CalcPadDisplay.Text) <> 0 Then
AccumCalc = _
Accum / CDbl(CalcPadDisplay.Text)
Else
CalcPadDisplay.BackColor = Color.Red
AccumCalc = 0
PendingOp = "Null"
Exit Function
End If
Case "Multiply"
AccumCalc = Accum * CDbl(CalcPadDisplay.Text)
Case "Add"
AccumCalc = Accum + CDbl(CalcPadDisplay.Text)
Case "Subtract"
AccumCalc = Accum - CDbl(CalcPadDisplay.Text)
End Select
End Function
End Class

rajiv sharma

Posts: 4
Nickname: rajsonu
Registered: Feb, 2006

Re: code for windows calculator using vb.net Posted: Feb 27, 2006 7:38 AM
Reply to this message Reply
Public Class CalcPad
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

Private Accum As Double
Private PendingOp As String
Private PendingOpFlag As Boolean

Property DisplayValue() As String
Get
Return CalcPadDisplay.Text
End Get
Set(ByVal Value As String)
End Set
End Property

Private Sub CalcPad_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
PendingOp = "Null"
PendingOpFlag = False
Accum = 0
End Sub

Private Sub op( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opplus.Click, opminus.Click, _
opdivide.Click, opmult.Click
Dim DisplayValue As Double
DisplayValue = CDec(CalcPadDisplay.Text)
If Accum = 0 Then
Accum = DisplayValue
Else
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = CStr(Accum)
End If
PendingOp = sender.tag
PendingOpFlag = True
End Sub

Private Sub opequals_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opequals.Click
CalcPadDisplay.BackColor = Color.White
If PendingOp <> "Null" Then
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = Accum
PendingOp = "Null"
PendingOpFlag = True
Accum = 0
End If
End Sub

Private Sub opclear_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opclear.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
PendingOp = "Null"
Accum = 0
End Sub

Private Sub opclearentry_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opclearentry.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
End Sub

Private Sub keyClick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles key1.Click, key2.Click, key3.Click, _
key4.Click, key5.Click, key6.Click, _
key7.Click, key8.Click, key9.Click, _
key0.Click, keydecimal.Click
CalcPadDisplay.BackColor = Color.White
If CDec(CalcPadDisplay.Text) = 0 _
Or PendingOpFlag = True Then
CalcPadDisplay.Text = sender.tag
PendingOpFlag = False
Else
CalcPadDisplay.Text &= sender.tag
End If
End Sub
Private Function AccumCalc(ByRef opcode As String)
Select Case opcode
Case "Divide"
If CDec(CalcPadDisplay.Text) <> 0 Then
AccumCalc = _
Accum / CDbl(CalcPadDisplay.Text)
Else
CalcPadDisplay.BackColor = Color.Red
AccumCalc = 0
PendingOp = "Null"
Exit Function
End If
Case "Multiply"
AccumCalc = Accum * CDbl(CalcPadDisplay.Text)
Case "Add"
AccumCalc = Accum + CDbl(CalcPadDisplay.Text)
Case "Subtract"
AccumCalc = Accum - CDbl(CalcPadDisplay.Text)
End Select
End Function
End Class

rajiv sharma

Posts: 4
Nickname: rajsonu
Registered: Feb, 2006

Re: code for windows calculator using vb.net Posted: Feb 27, 2006 7:38 AM
Reply to this message Reply
Public Class CalcPad
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

Private Accum As Double
Private PendingOp As String
Private PendingOpFlag As Boolean

Property DisplayValue() As String
Get
Return CalcPadDisplay.Text
End Get
Set(ByVal Value As String)
End Set
End Property

Private Sub CalcPad_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
PendingOp = "Null"
PendingOpFlag = False
Accum = 0
End Sub

Private Sub op( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opplus.Click, opminus.Click, _
opdivide.Click, opmult.Click
Dim DisplayValue As Double
DisplayValue = CDec(CalcPadDisplay.Text)
If Accum = 0 Then
Accum = DisplayValue
Else
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = CStr(Accum)
End If
PendingOp = sender.tag
PendingOpFlag = True
End Sub

Private Sub opequals_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opequals.Click
CalcPadDisplay.BackColor = Color.White
If PendingOp <> "Null" Then
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = Accum
PendingOp = "Null"
PendingOpFlag = True
Accum = 0
End If
End Sub

Private Sub opclear_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opclear.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
PendingOp = "Null"
Accum = 0
End Sub

Private Sub opclearentry_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opclearentry.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
End Sub

Private Sub keyClick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles key1.Click, key2.Click, key3.Click, _
key4.Click, key5.Click, key6.Click, _
key7.Click, key8.Click, key9.Click, _
key0.Click, keydecimal.Click
CalcPadDisplay.BackColor = Color.White
If CDec(CalcPadDisplay.Text) = 0 _
Or PendingOpFlag = True Then
CalcPadDisplay.Text = sender.tag
PendingOpFlag = False
Else
CalcPadDisplay.Text &= sender.tag
End If
End Sub
Private Function AccumCalc(ByRef opcode As String)
Select Case opcode
Case "Divide"
If CDec(CalcPadDisplay.Text) <> 0 Then
AccumCalc = _
Accum / CDbl(CalcPadDisplay.Text)
Else
CalcPadDisplay.BackColor = Color.Red
AccumCalc = 0
PendingOp = "Null"
Exit Function
End If
Case "Multiply"
AccumCalc = Accum * CDbl(CalcPadDisplay.Text)
Case "Add"
AccumCalc = Accum + CDbl(CalcPadDisplay.Text)
Case "Subtract"
AccumCalc = Accum - CDbl(CalcPadDisplay.Text)
End Select
End Function
End Class

rajiv sharma

Posts: 4
Nickname: rajsonu
Registered: Feb, 2006

Re: code for windows calculator using vb.net Posted: Feb 27, 2006 7:39 AM
Reply to this message Reply
Public Class CalcPad
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

Private Accum As Double
Private PendingOp As String
Private PendingOpFlag As Boolean

Property DisplayValue() As String
Get
Return CalcPadDisplay.Text
End Get
Set(ByVal Value As String)
End Set
End Property

Private Sub CalcPad_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
PendingOp = "Null"
PendingOpFlag = False
Accum = 0
End Sub

Private Sub op( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opplus.Click, opminus.Click, _
opdivide.Click, opmult.Click
Dim DisplayValue As Double
DisplayValue = CDec(CalcPadDisplay.Text)
If Accum = 0 Then
Accum = DisplayValue
Else
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = CStr(Accum)
End If
PendingOp = sender.tag
PendingOpFlag = True
End Sub

Private Sub opequals_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opequals.Click
CalcPadDisplay.BackColor = Color.White
If PendingOp <> "Null" Then
Accum = AccumCalc(PendingOp)
CalcPadDisplay.Text = Accum
PendingOp = "Null"
PendingOpFlag = True
Accum = 0
End If
End Sub

Private Sub opclear_Click( _
ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles opclear.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
PendingOp = "Null"
Accum = 0
End Sub

Private Sub opclearentry_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles opclearentry.Click
CalcPadDisplay.BackColor = Color.White
CalcPadDisplay.Text = "0"
End Sub

Private Sub keyClick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles key1.Click, key2.Click, key3.Click, _
key4.Click, key5.Click, key6.Click, _
key7.Click, key8.Click, key9.Click, _
key0.Click, keydecimal.Click
CalcPadDisplay.BackColor = Color.White
If CDec(CalcPadDisplay.Text) = 0 _
Or PendingOpFlag = True Then
CalcPadDisplay.Text = sender.tag
PendingOpFlag = False
Else
CalcPadDisplay.Text &= sender.tag
End If
End Sub
Private Function AccumCalc(ByRef opcode As String)
Select Case opcode
Case "Divide"
If CDec(CalcPadDisplay.Text) <> 0 Then
AccumCalc = _
Accum / CDbl(CalcPadDisplay.Text)
Else
CalcPadDisplay.BackColor = Color.Red
AccumCalc = 0
PendingOp = "Null"
Exit Function
End If
Case "Multiply"
AccumCalc = Accum * CDbl(CalcPadDisplay.Text)
Case "Add"
AccumCalc = Accum + CDbl(CalcPadDisplay.Text)
Case "Subtract"
AccumCalc = Accum - CDbl(CalcPadDisplay.Text)
End Select
End Function
End Class

S L

Posts: 1
Nickname: sivaz
Registered: Mar, 2006

Re: code for windows calculator using vb.net Posted: Mar 2, 2006 1:45 PM
Reply to this message Reply
i need VB.net code for Calculator, so badly if some one plz send me da code to red_aka_sankar@hotmail.com. dat would be much helpful. thankz u.

mar ia

Posts: 1
Nickname: dna
Registered: Apr, 2006

Re: code for windows calculator using vb.net Posted: Apr 21, 2006 5:39 AM
Reply to this message Reply
Hi,
please send to me the calculator u designed as fast as u can

regards

Esha castrafa

Posts: 1
Nickname: esh
Registered: Jun, 2006

Re: code for windows calculator using vb.net Posted: Jun 28, 2006 1:45 AM
Reply to this message Reply
ANYONE WITH THE CODES FOR windows calculator using vb.net
PLEASE HELP. eMAIL ME AT

esha4castrafa@gmail.com

WOULD BE REALLY VERY GREATFUL FOR UR HELP.

shabeer ali

Posts: 1
Nickname: msa786
Registered: Jul, 2006

Re: code for windows calculator using vb.net Posted: Jul 13, 2006 4:37 AM
Reply to this message Reply
assalamualikum,

hey fathima thnx for ur's calculator code in vb.net

if u have any other codes means plz send to my mail ok"shabeeralimd@yahoo.com"

Bethune Nicholson

Posts: 1
Nickname: betty
Registered: Jan, 2007

Re: code for windows calculator using vb.net Posted: Jan 29, 2007 11:01 PM
Reply to this message Reply
Cyrus,
Can you please send the code to bnich75@yahoo.com. I am having problems with the one I did. Thanks!!

Jermaine J

Posts: 1
Nickname: twin
Registered: Mar, 2007

Re: code for windows calculator using vb.net Posted: Mar 15, 2007 9:31 AM
Reply to this message Reply
Hey can yu send me the ciding for the calculator in C# please thanks alot.

Flat View: This topic has 26 replies on 2 pages [ « | 1  2 ]
Topic: Dekart  File Move Previous Topic   Next Topic Topic: Do I need to extend any of classes from AXIS  to return multiple values?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use