Click here to Skip to main content
11,933,854 members (57,022 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#

how to create a simple calculator using +,-,*,/ ,clear,dot ,10 buttons and single textbox alone in web application...

Posted 23-Feb-11 19:50pm
Edited 24-Feb-11 1:44am
Nishant Sivakumar 24-Feb-11 0:54am
If this is for a class project/assignment, I'd recommend not doing it. It's too trivial and will not really get you good grades.

If you want to do this as an exercise to help you learn, then well this is rather ironic :-)
Abhinav S 24-Feb-11 6:53am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Search Google for "JavaScript Calculator" and you will get lots of examples.

Okay, let me add some more details:
You need to add buttons for the numbers, dot and operators and a TextBox for showing the result.
For calculation there are two options - Using JavaScript to do it on the client side and other is posting the value to the server and calculating it there. The latter option is not at all recommended. Usually data is posted only when some server side interaction is needed. In this case JavaScript will do everything and server interaction is not at all needed.

Try doing it and get back in case you don't understand something.

Hope that helps!
Prerak Patel 24-Feb-11 1:13am
Good answer, sorry I misunderstood it first. +5
Ankur\m/ 24-Feb-11 1:14am
I was just going to suggest you to remove your answer because that will remove the vote too. :)
Prerak Patel 24-Feb-11 1:19am
I just removed it as it was no way relevant. I completely misunderstood the question.
Ankur\m/ 24-Feb-11 1:21am
Ah it's okay. No worries, it happens sometime. :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Here is mine, full source code:[^].

Yusuf 24-Feb-11 7:17am
SAKryukov 24-Feb-11 13:33pm
Thank you.
Pravin Patil, Mumbai 24-Feb-11 7:50am
Take my 5....
SAKryukov 24-Feb-11 13:34pm
Thank you (can be a bit better, I started to improve, did not finish...)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 24 Feb 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100