How to build a simple calculator?
-
it too Simple and i will not tell u about it , think Alone
Mohamad A. Flefel
+962 79 5963865
C#.net Developeri think that that you to dont know how to do it :laugh::laugh::laugh::laugh:
Tamimi - Code
-
i think abo rami could !!!!!!!!!1
Tamimi - Code
-
i think abo rami could !!!!!!!!!1
Tamimi - Code
-
i think that that you to dont know how to do it :laugh::laugh::laugh::laugh:
Tamimi - Code
-
-_-".... ur r making things diff4 me.. n i'm a she not him. n yes, this is a homework. =p
try to do it by your self, when you facing a problem come back here and you will be answered
Tamimi - Code
-
I had a problem. I had to create a simple calculator with VB.Net and this calculator had 0-9 buttons, add and minus function, a = button and a textbox for display of answer. I couldnt figure out the codings for the buttons. hope your can help me. thank you! =)
You got the response you did because we don't do people's homework here. If you try to do your own homework, then we're happy to help with specifics.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
try to do it by your self, when you facing a problem come back here and you will be answered
Tamimi - Code
hmmm... well... i have done the codings for each individual buttons. Eg for the button 9: Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click TextBox1.Text = 9 temp = 9 End Sub However, I can't figure out what should the code of '+' be. Since when a user clicks on it, he/she will select another number button. So is it simply this: TextBox1.Text = Int(TextBox1.Text) + Int(TextBox1.Text)
-
hmmm... well... i have done the codings for each individual buttons. Eg for the button 9: Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click TextBox1.Text = 9 temp = 9 End Sub However, I can't figure out what should the code of '+' be. Since when a user clicks on it, he/she will select another number button. So is it simply this: TextBox1.Text = Int(TextBox1.Text) + Int(TextBox1.Text)
-
-_-".... ur r making things diff4 me.. n i'm a she not him. n yes, this is a homework. =p
hi ( SHE ) u had entered a programmers site u can't ask questions like this
Mohamad A. Flefel mflefel@hotmail.com C#.net Developer
-
hi ( SHE ) u had entered a programmers site u can't ask questions like this
Mohamad A. Flefel mflefel@hotmail.com C#.net Developer
-
i had made a sample calculater i can send it to u its code is very easy
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
-
i had made a sample calculater i can send it to u its code is very easy
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
-
i had made a sample calculater i can send it to u its code is very easy
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
ok , here is my e-mail u can ask for help any time :)
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
-
ok , here is my e-mail u can ask for help any time :)
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
dont ever put you email on a fourm :suss:
Tamimi - Code
-
ok , here is my e-mail u can ask for help any time :)
Mohamad A. Flefel mflefel@hotmail.com +962 79 5963865 C#.net Developer
=) thank you. i have done the codings for each individual buttons. Eg for the button 9: Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click TextBox1.Text = 9 temp = 9 End Sub However, I can't figure out what should the code of '+' be. Since when a user clicks on it, he/she will select another number button. So is it simply this: TextBox1.Text = Int(TextBox1.Text) + Int(TextBox1.Text)
-
=) thank you. i have done the codings for each individual buttons. Eg for the button 9: Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click TextBox1.Text = 9 temp = 9 End Sub However, I can't figure out what should the code of '+' be. Since when a user clicks on it, he/she will select another number button. So is it simply this: TextBox1.Text = Int(TextBox1.Text) + Int(TextBox1.Text)
Here are some pointers: You need to hold some state somewhere. You also need to hold the fact that the user can type numbers like 98 (the code you showed does not append more digits, it replaces them). When a use clicks on an operator button (+-/*=) the program needs to store the current display, then it needs to accept a new number. When the user next pressed an operator it performs the function of the operator on the stored value and the current value. When a user clicks on a digit button it has to append the value on to the other digits received.
Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
-
I had a problem. I had to create a simple calculator with VB.Net and this calculator had 0-9 buttons, add and minus function, a = button and a textbox for display of answer. I couldnt figure out the codings for the buttons. hope your can help me. thank you! =)
I have some idea for you: A. For the numeric buttons write scrip like this:
private sub btn1_click(..) txtT.text = txtT.text & "1 end sub ' etc. for all numeric buttons
B. For command buttons ( + - * / etc. ) write this script:private sub plus_click(..) Tmp1 = cint(txtT.text) act="plus" txtT.text="" end sub
C. For = button write:private sub ans_click(..) Tmp2 = cint(txtT.text) select case act case "plus" : txtT.text = tmp1+tmp2 case "minus" : txtT.text = tmp1-tmp2 .... end select end sub
This code handle only one action per two numbers. If you wans to handle lot of actions, like windows calculator, you need to add a boolean trigger that will be True if one action had been chosen and when the user select another action it will do the action selected before, then put the result in Tmp1 and then reset the trigger to False. This process will continue until the user click the = button. I'll don't give the answer for this so quickly .. ;) I give you time to think about it. -
I have some idea for you: A. For the numeric buttons write scrip like this:
private sub btn1_click(..) txtT.text = txtT.text & "1 end sub ' etc. for all numeric buttons
B. For command buttons ( + - * / etc. ) write this script:private sub plus_click(..) Tmp1 = cint(txtT.text) act="plus" txtT.text="" end sub
C. For = button write:private sub ans_click(..) Tmp2 = cint(txtT.text) select case act case "plus" : txtT.text = tmp1+tmp2 case "minus" : txtT.text = tmp1-tmp2 .... end select end sub
This code handle only one action per two numbers. If you wans to handle lot of actions, like windows calculator, you need to add a boolean trigger that will be True if one action had been chosen and when the user select another action it will do the action selected before, then put the result in Tmp1 and then reset the trigger to False. This process will continue until the user click the = button. I'll don't give the answer for this so quickly .. ;) I give you time to think about it. -
=) thank u! i'll try later. oh ya. do you know of some websites which have tutorials? our lecturers just threw us this homework without giving any help... once again, thanks! hope you have a great day!!
aurora56 wrote:
do you know of some websites which have tutorials?
Well, based on this question
aurora56 wrote:
our lecturers just threw us this homework without giving any help...
I suspect this is not true. Giving you code is not helping you. The answer to all of this is just a google away. If you can't do the most basic research, you need to quit your course.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
=) thank u! i'll try later. oh ya. do you know of some websites which have tutorials? our lecturers just threw us this homework without giving any help... once again, thanks! hope you have a great day!!
Has Christian Graus said, if you can't do the basic research source codes may not help you. The idea of programming is to think about the algorithm you want to write and then think how to make it work in the easiest and quickly way you can. The speed is not only for saving project develop time yet also to increase the computer efficient. Processing resources is an expensive resource. There are few tips for you, when you want to write a computer program: 1. Define your needs and targets and the system the program will run over it (ex. windows XP, CE, Mobile Phone, etc.) 2. Multiply the targets into missions and sub-missions that will be easy to implement. 3. After you define the targets try to write algorithm (not in VB but in piece of paper) this will help you to rearrange your minds and way of work. you may also draw your tasks to think about visually. 4. The next step is to write it in VB and debugging. Good Luck ! Web site with source codes: http://www.planetsourcecode.com/ You may use such web sites (you may find a lot of them in one Google simple search) only for helping you with scripts you can't think about your own algorithm. those sites are not good for learning from the beginning.
Hope I helped you
&