Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm new to coding and would like to know what code I should use in order to have the operations buttons in my calculator working.

All I want to do is to add the correct code to my plus button, and so on.
I have tried many codes that I have found on the net but there always seem to be some sort of error.

What I have tried:

Many examples on the net, they can't all be wrong I'm obviously not doing something correctly.
Posted
Updated 20-Jun-16 14:38pm
Comments
an0ther1 20-Jun-16 19:23pm    
Hi Nikoskap,

Please improve your question by advising where you are having a problem & include the code you are experiencing a problem with.
Remember, we know only what you have told us - we cannot see your screen, your code nor can we read your mind.

Kind Regards
an0ther1 21-Jun-16 1:36am    
Since you have removed your initial response, I will remove mine
[no name] 21-Jun-16 2:00am    
Yes my response wasn't correct and I understand that there are many ways. However I did read your response and I understood what you meant. So I'll polish up on all this, get more into it and if needed I'll come back with something specific. Thanks.
an0ther1 21-Jun-16 18:15pm    
No problem Nikos.
Read up on how form controls raise events in Windows Forms & how you add them to a form control.

Kind Regards
[no name] 22-Jun-16 4:06am    
Ok. Im currently searching for a new approach of learning because I have been trying for the past two months with training videos etc but unless I get typing and really start getting to know how it all works I dont think Ill learn much. Thanks for the tip I'll check back.

1 solution

you could have a look at this Step 1: Create a Windows Forms Application Project[^] particularly steps 5,6.. there are plenty of other 'beginning winforms' articles on the web - let google be your friend - I say that not to be a pain, but pictures are worth a thousand words (trying to describe 'dragging a button from the toolbar onto a form and hooking up its event' sux in words) - once you've done it a few times, then its a matter of what control(s) do what

hint - draw/sketch the 'form' on a piece of paper - 'labels', textboxes (where you get information from and (can) display information back to your user), and buttons - name the labels, textboxes, buttons something appropriate - for example, a button with a '+' sign on it might be 'button_add' - a textbox for your main display may be 'textbox_results' - that means when you're in the 'handler' for your button(s), you know the result of the calculation gets written to textbox_results.Text
 
Share this answer
 
v2
Comments
[no name] 21-Jun-16 1:30am    
OK I'll dig deeper and if needed, I'll check back. Thanks.

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