Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have made an calculator application, everything is working fine but i have used a power button and i want to get zero on clicking the power button and after this if i will press any digit, it must give that particular digit i.e. 0 on on and after this if i will press 1, it must give 1 instead of 01.
Posted

Is this is a web based application of a desktop app.
Do you need to use the power button in this manner. What happens when you "power" off the calculator.

Typically you would set the application to 0 on load and then overwrite the value when you click a new digit, then subsequent digits get appended.
To rest everything to 0 you would have a seperate button usually called "C" to clear the screen.

In either case I assume that you have an event handler handling you power button press event. It sounds to me like the initial calculator value is not clearing so you need to implement that functionality. Maybe your saving it as a static variable.... not too sure without code.
 
Share this answer
 
write swtich case function at backend in page load
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900