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

i want the perfect coding

i want the perfect coding for making a SIMPLE CALCULATOR in vb

Coding fOr calculator

plz send me coding for scientific calculator using VB.net .

INPUTBOX

how can i get the value of Val(InputBox("Enter a name:")) ?
so that the name the user inputs will be displayed in a control label..
msg me in fb..
mimih.chaw@yahoo.com

TY

help me..

hoe to creating percentage coding. please help me. thank you so much.

hi to know the vb6.0 please

hi to know the vb6.0 please you can help me to do a simple calculator because i do not know to do please try to give me and simple calculator

cadizjamerlyn@yahoo.com

why vb is very difficult? i dont understand please help me to understand this vb?because i glad to understand vb?

VB is not at all

VB is not at all difficult.......
Its most easy GUI which is present 2de....
If u want to knw of it then pusrchase Visual Basic 6.0 BLACK BOOK... it vil help u....

HELP PLEASE

Dear Sir,
Iam making a calculator in VB6, but i dont know the codings for some functions like: Percentage, SquareRoot, SIN, COS and TAN. I will be very great full to you if you can help me in this, Please contact me through my email ID.

ThankYou
Asjad

P.S - I really need the codings for my project. Please help me....

Help please :)

Hi ...I am making a calculator too but i am sorta having problems with mine ...soo if you can please take a look and see whats wrong ....WOULD BE A GREAT HELP....thanks again !

Private Sub Cmdmultiply_Click()
FirstNumber = Val(Text1.Text)
Text1.Text = "0"
ArithmeticProcess = "*"
End Sub
Private Sub CmdSubtract_Click()
FirstNumber = Val(Text1.Text)
Text1.Text = "0"
ArithmeticProcess = "-"
End Sub
Private Sub CmdDivide_Click()
FirstNumber = Val(Text1.Text)
Text1.Text = "0"
ArithmeticProcess = "/"
End Sub
Private Sub Cmd0_Click()
Text1.Text = Text1.Text & "0"
End Sub

Private Sub Cmd1_Click()
Text1.Text = Text1.Text & "1"
End Sub

Private Sub Cmd2_Click()
Text1.Text = Text1.Text & "2"
End Sub

Private Sub Cmd3_Click()
Text1.Text = Text1.Text & "3"
End Sub

Private Sub Cmd4_Click()
Text1.Text = Text1.Text & "4"
End Sub

Private Sub Cmd5_Click()
Text1.Text = Text1.Text & "5"
End Sub

Private Sub Cmd6_Click()
Text1.Text = Text1.Text & "6"
End Sub

Private Sub Cmd7_Click()
Text1.Text = Text1.Text & "7"
End Sub

Private Sub Cmd8_Click()
Text1.Text = Text1.Text & "8"
End Sub

Private Sub Cmd9_Click()
Text1.Text = Text1.Text & "9"
End Sub

Private Sub CmdClear_Click()
Text1.Text = "0"
End Sub

Private Sub CmdDecimal_Click()
Text1.Text = Text1.Text & "."
End Sub

Private Sub CmdEqual_Click()
SecondNumber = Val(Text1.Text)
If ArithmeticProcess = "+" Then
AnswerNumber = FirstNumber + SecondNumber
End If
If ArithmeticProcess = "*" Then
AnswerNumber = FirstNumber * SecondNumber
End If
If ArithmeticProcess = "-" Then
AnswerNumber = FirstNumber - SecondNumber
End If
If ArithmeticProcess = "/" Then
AnswerNumber = FirstNumber / SecondNumber
End If
Text1.Text = AnswerNumber
End Sub

Whats wrong with your codes?

Whats wrong with your codes? is it running? i suggest you will use the else if statement...

Code to design a simple calculator in vb 6.0

hello sir, could you please send me the coding for designing a simple calculator for doing my project in visual basic.Please send me the codes for SQRT, %, 1/X, CE, MR, MC, MS, M+,+/-. these buttons i have chose from the sample calculator that is present by default in every PCs. please send as soon as possible. thank you!!!!!!!!!!!!!!!!!!!!!!!!!

SQRT

please can you help me!!
what is the codes of SQRT

vb

what does call mean in vb??

hey

its a visual basic..
another kind of computer language..

it is very nice code and it

it is very nice code and it will help me a lot

comment

very nice

help! unsai codes para sa

help! unsai codes para sa simple calculator sa vb?

help me plz

thank you
I hope to help me in my project cause i can't complete it
............................................................................................
(general)
Dim op As String
Dim num3 As Integer
Dim num1 As Integer
Dim num2 As Integer

Private Sub Command1_Click()
Text1.Text = Text1.Text & "1"
End Sub

Private Sub Command10_Click()
Text1.Text = Text1.Text & 0
End Sub

Private Sub Command11_Click()
Text2.Text = Text2.Text & "1"
End Sub

Private Sub Command12_Click()
Text2.Text = Text2.Text & "2"
End Sub

Private Sub Command13_Click()
Text2.Text = Text2.Text & "3"
End Sub

Private Sub Command14_Click()
Text2.Text = Text2.Text & "4"
End Sub

Private Sub Command15_Click()
Text2.Text = Text2.Text & "5"
End Sub

Private Sub Command16_Click()
Text2.Text = Text2.Text & "6"
End Sub

Private Sub Command17_Click()
Text2.Text = Text2.Text & "7"
End Sub

Private Sub Command18_Click()
Text2.Text = Text2.Text & "8"
End Sub

Private Sub Command19_Click()
Text2.Text = Text2.Text & "9"
End Sub

Private Sub Command2_Click()
Text1.Text = Text1.Text & "2"
End Sub

Private Sub Command20_Click()
Text2.Text = 0
End Sub

Private Sub Command21_Click()
num1 = Val(Text1.Text)
num2 = Val(Text2.Text)
num3 = num1 * num2
Text3.Text = ""
Text3.Text = num3
op = "*"
End Sub

Private Sub Command22_Click()
num1 = Val(Text1.Text)
num2 = Val(Text2.Text)
num3 = num1 / num2
Text3.Text = ""
Text3.Text = num3
op = "/"
If IsNumeric(Text1.Text) / (Text2.Text) = fales Then
MsgBox "you are loser"
End If
End Sub

Private Sub Command23_Click()

End Sub

Private Sub Command25_Click()
If op = "*" Then
Text3.Text = num1 * num2

End If
End Sub

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

Private Sub Command3_Click()
Text1.Text = Text1.Text & "3"
End Sub

Private Sub Command4_Click()
Text1.Text = Text1.Text & "4"
End Sub

Private Sub Command5_Click()
Text1.Text = Text1.Text & "5"
End Sub

Private Sub Command6_Click()
Text1.Text = Text1.Text & "6"
End Sub

Private Sub Command7_Click()
Text1.Text = Text1.Text & "7"
End Sub

Private Sub Command8_Click()
Text1.Text = Text1.Text & "8"
End Sub

Private Sub Command9_Click()
Text1.Text = Text1.Text & "9"
End Sub

Private Sub Form_Load()
Form1.BackColor = vbWhite
End Sub

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
Frame1.BackColor = vbGreen
End Sub

Private Sub Label1_Click()
Label1.BackColor = vbBlack
End Sub

Private Sub Text1_Change()
Text1.BackColor = vbBlack
End Sub

Private Sub Text2_Change()
Text2.BackColor = vbbalck
End Sub

Private Sub Text3_Change()
Text3.BackColor = vbBlack
End Sub

tank you pleas send me

tank you pleas send me windowse Calculator vb code
tank u mer30

i dont understand how to

i dont understand how to take 3 text boxes.

Simple calculaotr

I am trying to code a simple calculator, please help. I need two textboxes, one on each side of three buttons. each button has an operation: button1 is to add, button2 is to subtract, button3 is to multiply. when clicking on the button(s) it will preform the funtion with textbox1 and textbox2. Example: textbox1 is 2 and textbox2 is 2, when the add button is pushed the output(textbox3) will read 2 + 2 = 4. If the subtraction button is pushed the output would be 2 - 2 = 0

Visual Basic

I to be SEC

Nice

Excelent Calculator.

Re

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...

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 :)

for knoledge

plz

advise me
how to creat a calculator
thanks

hiiiiiiiii

hi plz specify the working of cmdoperator & command3 & how the whole code will run plz reply soon

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......................

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