A simple calculator

Level:
Level2

Written By TheVBProgramer.

PROGRAMMING EXERCISE

Calculator

 

Write a VB program that simulates the basic functions and behavior of the Windows calculator program. To study its interface, you can run it by clicking the Start button on the taskbar, then go to Programs, then Accessories. You should at least support the basic functions of addition, subtraction, and multiplication, as well as changing the sign of the number (the +/- key). It's up to you if you want to support the sqrt, %, and 1/x functions. Don't bother with the "M" keys on the left (MC, MR, MS, M+) or the scientific features.

 

 

 

Download solution source code here.

 

Comments

Nice

Excelent Calculator.

bca

Basic coading of vb

simple calculator

plese give me coding

can u pls help me with my

can u pls help me with my project??

8s ol abwt Page Memory Allocation Method...

i ned to develop a program that wil results to this kind of allocation method...

pls help me..

i really badly needed it A.S.A.P

thanks a lot in advance....

scientific calculator code

can u please help me ... i need a code of scientific calculator,,,,i need it..argentl

thanx u

thanx u veeeeeeeeerrrrrrrrrrry much

Calculator problem

Thanks for the calculator program.but there is one problem in it.So will some one help me. here is problem:-when we entering "0.1" value from the keyboard it display only ".1" so i need the whole number as it is that i entered. it means if i type "0.1" then the label should have to display "0.1". as entered text... Please help me.

If I listened correctly

If I listened correctly today in programming it seems that the numbers are all "integers" what you need is "real" numbers.

hello, very nice

Thanks!

The calculator program helped me a lot. Thanks a million! :)

pls. give me the coding of simple calculator..

pki send nga po ung coding ng simple calculator skin po...thank you very much!!!
:)

HI

please help me I need VB codes for creating a simple note book

hai!!

thanks for the VB calculator!! it's A great help!!! thanks!!

project in vb6 caculator

i am a beginner .where can I get the code of Visual Bbasic 6.0 calculator? can i have the source code? can you please send it to my email
This is my email: openminded.play835@gmail.com

Thank You

HEY!!

i am trying to make a code that says Kristofer Richard Littlemore in ottawa ontario manotick is a fag lmao

text1.text=("Kristofer

text1.text=("Kristofer Richard Littlemore in ottawa ontario manotick is a fag lmao")

code for calculator

plz send me coding for scientific calculator using c#.net .

how to make setup file

hai i created a project using c#.net .i want make it as a setup file.how to do it?

download the code

you can download the calculator vb code from the link below

http://www.vb6.us/files/VBPrograms/calculator/Calculator.zip

Marnelle

here another code for simple calculator

Dim sign As String
Dim ans As String

Private Sub Clear_Click()
Text1.Text = ""
End Sub

Private Sub cmdOperator_Click(Index As Integer)
sign = cmdOperator(Index).Caption
ans = Text1.Text
Text1.Text = ""
End Sub

Private Sub Command3_Click(Index As Integer)
Text1.Text = Text1.Text + Command3(Index).Caption
End Sub

Private Sub Equals_Click()
Select Case sign
Case Is = "+"
Text1.Text = Str$(Val(ans) + Val(Text1.Text))
Case Is = "-"
Text1.Text = Str$(Val(ans) - Val(Text1.Text))
Case Is = "*"
Text1.Text = Str$(Val(ans) * Val(Text1.Text))
Case Is = "/"
Text1.Text = Str$(Val(ans) / Val(Text1.Text))
End Select
End Sub

just email me if you want to know how to make this one work :)

help me

thank you

calculator

eii..wud u mine to help me in d coding of simple calculator? thnks...

vb program

hey guy .. how are you ??? it is really a very simple program , really nice it learns me a lot. thanking you . a very good night ..

hiiiiiiiiiiiiiiiiiiiiiiiii

it is really a fantabulous program . it helps me alot to create or learn visual basic as much easier as simple... thanxxxx a lottt....good night....

simple calculator

hello sir can you help to make my calculator? my problem is that how can you make the text having two digits or three digits at the text please help me

hi

is there other code for the calculator

vb6 code

does it really works??

Hi

elow!good day,i want to know some things needed i making a keyboard narrator?please teach me how to implement the software i want to develop.is it need to have a database?or folder only to put the mp3.files.thank you

Simple calc

Pls i want to know hw it works

download file

Thanks for recommendations!

Thanks for recommendations! http://www.picktorrent.com

visual basic

mujhe calculator ka program chaheye coding shahit

INSANE MATE THANKS MAKES ME

INSANE MATE THANKS MAKES ME VERY HAPPY THIS

VB

can you help me from my project a standard calculator using vb6.0,please asap....

reply

can you help me from my project a standard calculator using vb6.0,please asap....

library

hello...? I need a simplest coading of library system using VB 6 . plz help me n send me the simplest coding of library system using VB 6......................

how to write a code for simple calculator in visual basic 6.0

it is good but plz send me a code for simple calculator in visual basic 6.0

how to start

please help me to make a program.. we had a project to submit but i dont know where to start... we need to make a material directory system in one of an electronics company.. can you help me please... i need your help badly...
just email me @ albonena@yahoo.com.
i will wait for your immediate response.
tnx

Levelling Computation

Please can you help me write programme in VB for levelling computation using the method of "Height of Collimation"?

Calculator

Please help me out I need the coding for the hexadecimal, binary,octal and decimal using the option buttons. My E-mail add is reve_q@yahoo.com

vb pricing system

plz give me a sample on how it work..
plz email me:raven_wind2020@yahoo.com

Wala koy masulti anang imong

Wala koy masulti anang imong ge request kay wala pud ko kabalo ana,kasabot ka?

VB Doubt

i need the coding for decimal point(.) and sqrt function in calculator in vb6.0
pls help...

decimal n squareroot buttons function code

*************Decimal**************
Public mFun As Boolean
If mFun = True Then
txtans.Text = "." ' New entry
mFun = False
Else
txtans.Text = txtans & "." ' Continuation
mFun = False
End If
***********Squareroot***************

Private Sub cmdsqrt_Click()
txtans = Sqr(CDbl(txtans.Text)) ' For squareroot
End Sub
******************************************************************
"txtans" is your textbox where answer is to be desplayed.

Calculator

I need a simplest coading of caculator using VB 6 . plz help me n send me the simplest caoding of calculator using VB 6......................

vb codes pay roll

Am doing a project in vb 6 for my school and am kind of new in the Vb world, somebody helps me with the codes that generates the total of products automatically? I will apreciate it alot..good time

calculator code without array

help...i need a calculator code without array

Calculator without Array

Option Explicit

Public i As Double
Public memVal As Integer
Public CalOperation As Integer
Public mFun As Boolean
Public A As Integer
Public copyans

Private Sub cmd0_Click()
If mFun = True Then
txtans.Text = "0" ' New entry
mFun = False
Else
txtans.Text = txtans & 0 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd1_Click()
If mFun = True Then
txtans.Text = "1" ' New entry
mFun = False
Else
txtans.Text = txtans & 1 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd2_Click()
If mFun = True Then
txtans.Text = "2" ' New entry
mFun = False
Else
txtans.Text = txtans & 2 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd3_Click()
If mFun = True Then
txtans.Text = "3" ' New entry
mFun = False
Else
txtans.Text = txtans & 3 ' Continuation
mFun = False
End If

End Sub

Private Sub cmd4_Click()
If mFun = True Then
txtans.Text = "4" ' New entry
mFun = False
Else
txtans.Text = txtans & 4 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd5_Click()
If mFun = True Then
txtans.Text = "5" ' New entry
mFun = False
Else
txtans.Text = txtans & 5 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd6_Click()
If mFun = True Then
txtans.Text = "6" ' New entry
mFun = False
Else
txtans.Text = txtans & 6 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd7_Click()
If mFun = True Then
txtans.Text = "7" ' New entry
mFun = False
Else
txtans.Text = txtans & 7 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd8_Click()
If mFun = True Then
txtans.Text = "8" ' New entry
mFun = False
Else
txtans.Text = txtans & 8 ' Continuation
mFun = False
End If
End Sub

Private Sub cmd9_Click()
If mFun = True Then
txtans.Text = "9" ' New entry
mFun = False
Else
txtans.Text = txtans & 9 ' Continuation
mFun = False
End If
End Sub

Private Sub cmdadd_Click() ' For Adding
mFun = True
txtop.Text = txtans.Text
CalOperation = 1
End Sub

Private Sub cmdbackspace_Click() ' Backspace
Dim x As String
Dim ylen As Integer

If txtans = vbNullString Then
Else

x = Val(txtans.Text)
ylen = Len(txtans.Text)
txtans.Text = Mid(x, 1, (ylen - 1))
End If
End Sub

Private Sub cmdcancel_Click() 'Cancel
txtans.Text = ""
End Sub

Private Sub cmdcube_Click() 'Cube
txtans = CDbl(txtans.Text) * CDbl(txtans.Text) * CDbl(txtans.Text)
End Sub

Private Sub cmdCE_Click() 'Clear Everything
txtans.Text = ""
End Sub

Private Sub cmddecimal_Click() 'Decimal button
If mFun = True Then
txtans.Text = "." ' New entry
mFun = False
Else
txtans.Text = txtans & "." ' Continuation
mFun = False
End If
End Sub

Private Sub cmddivide_Click() 'For Division
mFun = True

txtop.Text = txtans.Text
CalOperation = 4
End Sub

Private Sub cmdequalsto_Click()

Dim Answer As Double

Select Case CalOperation ' 1 : Add, 2 : Minus, 3: Multiply, 4: Division, 5: Sign, 6: Power, 7: Cube
' 8: Inverse, 9: Log,
Case 1 '(Addition)
Answer = CDbl(txtop.Text) + CDbl(txtans.Text)
txtans.Text = Answer
Case 2 '(Subtraction)
Answer = CDbl(txtop.Text) - CDbl(txtans.Text)
txtans.Text = Answer
Case 3 '(Multiplication)
Answer = CDbl(txtop.Text) * CDbl(txtans.Text)
txtans.Text = Answer
Case 4 '(Division)
If txtans.Text > 0 Then
Answer = CDbl(txtop.Text) / CDbl(txtans.Text)
txtans.Text = Answer
Else
txtans.Text = "Not defined"
End If
Case 5 '(Sign)
Answer = Val(txtans.Text) * -1
txtans.Text = Answer
Case 6 'Power
Answer = CDbl(txtop.Text) ^ CDbl(txtans.Text)
txtans.Text = Answer
'Case 11 'Pi
'Answer = CDbl(txtans.Text) + CDbl(txtop.Text)
'txtans.Text = Answer

End Select

End Sub
Private Sub cmdfactorial_Click() 'Factorial function
Dim k As Integer
Dim factorialans As Double

Dim maxfac As Integer
Dim maxfacloop
maxfacloop = (Val(txtans.Text) - 1) ' 4
maxfac = Val(txtans.Text)
factorialans = maxfac ' 4

For k = 1 To maxfacloop ' 4
factorialans = factorialans * (maxfac - 1) ' 0 = 4 x 3 = 12
maxfac = maxfac - 1 ' 4 - 1 = 3
Next k
txtans.Text = factorialans

End Sub

Private Sub cmdinverse_Click() ' For Inverse
txtans = 1 / CDbl(txtans.Text)
End Sub

Private Sub cmdlog_Click() ' For squareroot
txtans = Sqr(CDbl(txtans.Text))
End Sub

Private Sub cmdM_Click() ' For Memory add function
mFun = True
txtop.Text = txtans.Text
memVal = memVal + Val(txtop.Text)

If memVal > 0 Then
txtM = "M"
Else
txtM = ""
End If
End Sub

Private Sub cmdMC_Click() ' For Memory clear
txtans.Text = " "
memVal = 0
txtM = vbNullString
End Sub

Private Sub cmdMR_Click() ' For Memory recall
txtans.Text = memVal
End Sub

Private Sub cmdMS_Click() 'Memory Store
mFun = True
txtop.Text = txtans.Text
memVal = txtop.Text
If Val(memVal) > 0 Then
txtM = "M"
Else
txtM = ""
End If
End Sub

Private Sub cmdmultiply_Click() ' For Multiplication
mFun = True
txtop.Text = txtans.Text
CalOperation = 3
End Sub

Private Sub cmdpi_Click() 'For Pi=3.14
txtans.Text = "3.14"
End Sub

Private Sub cmdpower_Click() ' For Power
mFun = True
txtop.Text = txtans.Text
CalOperation = 6
txtans = vbNullString

End Sub

Private Sub cmdpercentage_Click() 'Percentage
txtans = (txtop.Text * txtans.Text) / 100
End Sub

Private Sub cmdsign_Click()
CalOperation = 5 ' For sign
End Sub

Private Sub cmdsq_Click() ' For Square
txtans = CDbl(txtans.Text) * CDbl(txtans.Text)

End Sub

Private Sub cmdsqrt_Click()
txtans = Sqr(CDbl(txtans.Text)) ' For squareroot
End Sub

Private Sub cmdsubtract_Click() ' For Substraction
mFun = True
txtop.Text = txtans.Text
CalOperation = 2
End Sub

Private Sub Form_Load() 'On Form load
mFun = False
txtans.Text = ""
End Sub

Private Sub mnucopy_Click() 'Copy

copyans = txtans.Text
End Sub

Private Sub mnupaste_Click() 'Paste
txtans.Text = copyans
End Sub

help

hai

please read

how many command buttons were used in this project?thanks:)

hmn,how about the interface?

its interface in vb 6.0..is it the same as the one above?
i am always fascinated upon making a simple calculator,but i am a newbie in vb environment,..i have a lot of questions in my mind regarding the coding.
please help.

hi

can you help me, our instructor want a simple calculator with backspace then the codes are in the module(VB 6)... can you sent a sample. you can send to my yahoomail.
cmaryla@yahoo.com..
we are going to pass today..

Help!!!

hi....i need the source code for calculator program in VC++ to do my project......

Installment Calculator - VB code

Hi,

Can you help me out with the code for an installment calculator, as i require this for my major projet. I am a beginner and i don't know where and how to start. Require the code by 20/08/2009

Much Appreciated

calculator problem

pls give me your calculator codes in Vb.net.,.,
i am a beginner and i don't know where and how to start.. i really need it right now.,.
can u pls send it to me right at this very moment?!!pls
here is my account: slabutap@yahoo.com
tnx!!!Godbless

where?

please give the codes!!!!

e-mail me :)))) PLEEEEEEEEEEEEEEEEEEEEAAAAAAASEEEEEEEEEEEEEEEE.

CALCULATOR help!

i am a 2nd year college IT student. we have a case study to be submitted on tuesday. how can i make a simple calculator using 1 text box only and using an array for the command buttons(for numbers).
please help me. thanks. i really need it...

SCIENTIFIC CALCULATOR

HEY PLS CAN U SEND ME THE THE PROGRAM R CODING FOR THE SCIENTIFIC CALCULATOR.......NEED IT URGENTLY....PLS SEND IT AS SOON AS POSSSIBLE....................
ID:smooth.abi@gmail.com

VB6

send me a code of a simple calculator..NOW !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
THANK YOU.. i need now.. do you understand?? i said now..

you are a tool, do your own

you are a tool, do your own homework

Help Me plz...

Can u send me a code on a simple calculator that can add, subtract, minus and devide..

vb6

hi.....................can you give the code of calculator.because our project!!!!!!!!!!!!

help..

hi there.i am just an it student and im a begginer and it will be great if you can help me and send to me the codes of this calculator for my assignment scientific calculator that will submit 5days from now..thanks a lot it would be a big help for me.:] xxchuke13xx@yahoo.com

Can U SEND ME CODES OF THIS

Can U SEND ME CODES OF THIS VISUAL BASIC PROGRAMS........
MY EMAIL IS swastikaconan@yahoo.com

calculator in vasiual basic 6.0

plz send me a code in calculator that is easy to understand.....

Help Me Plz

I had made program In VB6 using MS-Excel

Column A Column B Column C Column D
EG 0.1 Auto 2.3397648
JAH270CN 0.15 Mannual 3.5096472
JSC-2070 EN 0.2 4.6795296
JSC270CC 0.25 5.849412
JSH270CN-P 0.3 7.0192944
MFZn5-G 0.35 8.1891768
MISC 0.4 9.3590592

Problem is:

Column A is ComboBox 1

Column B is ComboBox 2

Column C is ComboBox 3

I just want that when I select Auto in ComboBox 3, the text Box Answers As in "Column D"

Example If I Select ComboBox 1 As " JSC270CC "

&

Select ComboBox 2 As " 0.25 "

then I select Auto in ComboBox 3

the Answer Must be " 5.849412 " As in Colunm " D "

Hi der!

hi...I am a 4th yr high we are already in visual basic but still i am confuse with the codes.Sometimes the codes are interchange. so I need a little background in doing such thing. I am begging you to please really help me. please...

Ready to help in VB6 Programming

Hi,
Just now, I saw your request,

I am a vb6 programmer and applications designer and algorythms implementer,

If you need support , send me your problems and I will send you my solutions,

Regards
Engineer Maher

hi

a have a problem about programming its how to make a code using combo box . i dont know how so can u help me any kind of program u can send

thanks sorry to disturb

Calculator

there are lots of ways to make a calculator but feel free to use mine

PS. i use visual basic 6.0 for that code

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags. You may also post inline code using <code [type="language"]>...</code> tags.

More information about formatting options