Maths in VB?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Salochin
    New Member
    • Oct 2008
    • 22

    Maths in VB?

    Any Help appriciated

    Hi all below is what I need to work out basics: I want a form to work out Price per ream and show it in a text box as £££ the form will be manually updated with "Price per Box" and "Reams per Box" Only..

    Price_Per_Ream = Price_Per_Box divided by Reams_Per_Box


    Thanks in anticipation..

    Sal
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Just write the math expression as it comes. If the values are introduced as text, using the VAL function would be nice:

    Price_Per_Ream. Text = Val(Price_Per_B ox.Text) / Val(Reams_Per_B ox.Text)

    Assuming those are the names of your textboxes

    Comment

    • Salochin
      New Member
      • Oct 2008
      • 22

      #3
      Originally posted by kadghar
      Just write the math expression as it comes. If the values are introduced as text, using the VAL function would be nice:

      Price_Per_Ream. Text = Val(Price_Per_B ox.Text) / Val(Reams_Per_B ox.Text)

      Assuming those are the names of your textboxes
      Thanks, had to change slightly but it worked, looking at it I guess I wasnt far off just couldnt seem to get my gray matter around it (typical monday):

      Below is what I did using your help, no idea why i couldnt figure that out I was assuming it would be more complex :/ I am new at this but enjoying the learning so guess im not the only one ...
      Private Sub PricePerReam_En ter()
      PricePerReam = (PricePerBox) / (ReamsPerBox)
      End Sub

      Private Sub PricePerSheet_E nter()
      PricePerSheet = (PricePerReam) / (SheetsPerReam)
      End Sub

      Thanks for your help

      Sal

      Comment

      Working...