CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Math

  1. #1
    Join Date
    Jan 2001
    Location
    Canada
    Posts
    150

    Math

    I need to know how to add, subtract, multiply and divide using vb5.0. I'm converting timer seconds into min.

    Thankz, Drew
    [email protected]
    Thanks, Drew

  2. #2
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222

    Re: Math


    Dim numberOne as Integer
    Dim numberTwo as Integer
    Dim result as Integer

    Sub math()
    numberOne = 5
    numberTwo = 10

    'Addition (result will be 5 + 10 = 15)
    result = numberOne + numberTwo

    'Substraction (result will be 10 - 5 = 5)
    result = numberTwo - numberOne

    'Division (result will be 10 / 5 = 2)
    result = numberTwo / numberOne

    'Multiplication (result will be 5 * 10 = 50)
    result = numberOne * numberTwo
    End Sub




    ----------------
    You can contact me directly at [email protected]
    Hey, and... don't forget your parsley cause you can't eat your dog after having stolen him from some animal shelter and having drowned him in the Atlantic Ocean.
    Teamwork Software - Stuff That Does Something

  3. #3
    Join Date
    Jun 2000
    Posts
    104

    Re: Math

    how ever if you are directly adding/substructing/multiplying two nubers in two textboxes you have to use the val function.


    text3.text=val(text1.text)+val(text2.text)
    text3.text=val(text1.text)-val(text2.text)
    text3.text=val(text1.text)*val(text2.text)







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

Featured