Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Homework
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 at 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 at 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 at 24-Feb-11 1:13am
Good answer, sorry I misunderstood it first. +5
Ankur\m/ at 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 at 24-Feb-11 1:19am
I just removed it as it was no way relevant. I completely misunderstood the question.
Ankur\m/ at 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 at 24-Feb-11 7:17am
SAKryukov at 24-Feb-11 13:33pm
Thank you.
Pravin Patil, Mumbai at 24-Feb-11 7:50am
Take my 5....
SAKryukov at 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
0 Maciej Los 580
1 OriginalGriff 420
2 Sascha Lefévre 289
3 Abhinav S 220
4 CHill60 200
0 Sergey Alexandrovich Kryukov 9,773
1 OriginalGriff 9,290
2 Peter Leow 5,137
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,036

Advertise | Privacy | Mobile
Web02 | 2.8.150327.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