This document contains the code for a basic calculator application with four math operators: add, subtract, multiply and divide. It includes code for buttons to perform each operation, clear the fields, and exit the program. The code takes numeric values from two text boxes, performs the selected operation, and displays the result in a third text box.
This document contains the code for a basic calculator application with four math operators: add, subtract, multiply and divide. It includes code for buttons to perform each operation, clear the fields, and exit the program. The code takes numeric values from two text boxes, performs the selected operation, and displays the result in a third text box.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
This document contains the code for a basic calculator application with four math operators: add, subtract, multiply and divide. It includes code for buttons to perform each operation, clear the fields, and exit the program. The code takes numeric values from two text boxes, performs the selected operation, and displays the result in a third text box.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
2. Text3 = Val(Text1.Text) + (Text2.Text) 23. Text3 = Val(Text1.Text) / (Text2.Text) 3. Text1.Text = "" 24. Text1.Text = "" 4. Text2.Text = "" 25. Text2.Text = "" 5. Text3 = Text3 26. Text3 = Text3 6. End Sub 27. End Sub 7. 28. 8. Private Sub cmd2_Click() 29. Private Sub cmdclear_Click() 9. Text3 = Val(Text1.Text) - (Text2.Text) 30. Text1.Text = "" 10. Text1.Text = "" 31. Text2.Text = "" 11. Text2.Text = "" 32. Text3.Text = "" 12. Text3 = Text3 33. End Sub 13. End Sub 34. 14. 35. Private Sub CmdExit_Click() 15. Private Sub cmd3_Click() 36. End 16. Text3 = Val(Text1.Text) * (Text2.Text) 37. End Sub 17. Text1.Text = "" 18. Text2.Text = "" 19. Text3 = Text3 20. End Sub 21.
Object Icon Property Property Settings
Form Name FrmCalculator
Caption Calculator Program Name cmd1 Caption add Add button Font MS Sans Serif/ Bold/12 Name cmd2 Caption subtract Subtract button Font MS Sans Serif/ Bold/12 Name cmd3 Caption multiply Multiply button Font MS Sans Serif/ Bold/12 Name cmd4 Caption Divide Divide button Font MS Sans Serif/ Bold/12 Name cmdClear Caption Clear Clear button Font MS Sans Serif/ Bold/12 Name cmdExit Caption Exit Exit button Font MS Sans Serif/ Bold/12 Name lblprompt Caption Enter an Number: Label Font MS Sans Serif/ Bold/14 Name lblprompt2 Caption Enter an Number: Label Font MS Sans Serif/ Bold/14 Name Lblprompt3 Caption = Label Font MS Sans Serif/ Bold/14 Name Text1 BackColor System/Inactive Title Bar Text Box Text (empty) Font MS Sans Serif/ Bold/12 TabIndex 0 Name Text2 BackColor System/Inactive Title Bar Text Box Text (empty) Font MS Sans Serif/ Bold/12 TabIndex 1 Name Text3 BackColor System/Inactive Title Bar MaxLength 255 Text Box Text 0 Font MS Sans Serif/ Bold/12 Enable False