Results 1 to 3 of 3

Thread: Calculator

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    21

    Talking Calculator

    In order to add in a calculator you need to first enter the first number then click "+" and enter the second number. My problem is that when the user clicks "+" the text box will be set to "". So how can I add the second number

  2. #2
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152

    Re: Calculator

    Store the first number in a variable, then store the second number in another variable... then add them and display in the textbox

    VB Code:
    1. Private Function Example()
    2. Dim FirstNum, SecondNum As Integer
    3. FirstNum = "0"
    4. SecondNum = "0"
    5. FirstNum = Text1
    6. ' do whatever to textbox and then add other number
    7. SecondNum = Text1
    8. Msgbox FirstNum + SecondNum
    9. end function

    something like that should do fine...didn't try it in VB yet, so good luck
    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  3. #3
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Calculator

    Have a look at the calculator that comes with VB6.
    Attached Files Attached Files
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width