Log in

View Full Version : Code for a simple calculator


sheenie
Oct 5, 2009, 09:52 PM
Hello everyone,
Please...
Who can help me making code in simple calculator?.
I really don't know how to make a code, I just design a simple calculator in Vb 6.0 it has a basic functions...
Thanks.

Perito
Oct 7, 2009, 02:36 PM
Here's an answer I gave some time ago for this same problem:

https://www.askmehelpdesk.com/visual-basic/16-buttons-calculator-coding-369748.html

Basically you drop 10 buttons on a form and label them 0 through 9. Drop 5 more buttons on the form and label them +, -, *, /, and =. Drop a textbox on a form for the result. Put two more buttons on the form and label them "C" and "CE" for clear and clear entry. You have to write code to handle the pushing of the buttons. You have to figure out the "state" of the calculator. There are at least these states:

1. The first number has not been entered or is being entered.
2. The first number has been entered and a function key has been pressed (not =)
3. A second number has been entered and another function key has been pressed (not =)
4. At least two numbers have been pressed and the = button has just been pressed.

Are you just supposed to design this without actually writing code?