Ask Experts Questions for FREE Help!
 

Free Answers in 3 Easy Steps

Register Now
3 Steps
 


Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.
  Answer this Question    Ask about Visual Basic    Ask about another Subject  
 

lolz
Feb 12, 2009, 12:11 AM
i am a student at college in somaliland. one of my instructors told me to write a small programme for a calculator in visual basic 6.0. so, im stuck with this. help me with the codes.

rwinterton
Feb 14, 2009, 06:13 AM
Start by putting five buttons on a form and a two textboxes to hold numbers. Put "+", "-", "*", "/" and "C" on each of the four buttons (or "Add", "Sub", "Mul", "Div" and "Clear" respectively.

Make one textbox "read/only". And put a "0" in the box. That will be the "answer box". Put a "0" in the other box. That will be the "user's box". Name the boxes "txtAnswer" and "txtOperand"

Double-click on each key to create a key-click handler.

The user will enter a value in his text box and click one of the keys. When he clicks the key, you either add, subtract, multiply, or divide (depending on the key that is clicked) the value in the "answer" box with the number in the user's box. Place the result in the answer box.

Here's code for the "+" handler:

Dim NewValue as double = cdbl(txtOperand.text)
Dim OldValue as double = cdbl(txtAnswer.text)
Dim Answer as double
' if the "ADD" button is clicked, add them.
Answer = NewValue + OldValue
txtAnswer.text = cstr(Answer)

Do this for each of the buttons.

When the user hits the "Clear" button, put a zero in the "answer" box.

nano12
Mar 29, 2009, 03:58 AM
Iam a physics student and my professor asked me to write a visual basic 2005 for both standard and scientific calculator and I have no idea what to do please help me