Results 1 to 2 of 2

Thread: greater than

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    greater than

    this seemed to be working fine...but i came across this:

    dim itemtotal, headertotal as double

    headertotal = 90.11
    itemtotal = 65.04
    txtitemcost.text = 25.07

    it goes to the msgbox, I thought it may of been a rounding issue but I inserted another purchase using the same decimals
    headertotal = 50.11
    itemtotal = 25.04
    txtitemcost.text = 25.07...that worked fine..am I missing something here?



    VB Code:
    1. If (itemTotal + CDbl(txtItemCost.Text)) > headerTotal Then
    2.      amountneeded = (headerTotal - itemTotal)
    3.      MsgBox("Item total is greater than Receipt amount" & vbCrLf & vbCrLf & "Receipt Total: $" & headerTotal & vbCrLf & "Item Total: $" & itemTotal & vbCrLf & vbCrLf & "Amounted needed to balance: $" & amountneeded, MsgBoxStyle.Information, "PCMS ")
    4.                 Exit Sub
    5.             End If
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  2. #2

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    I ran a test here and got the value of:

    Dim x As Double
    x =(itemTotal + CDbl(txtItemCost.Text))
    x = 90.1100000000014...this does indeed make it greater than...is there a way I can trim this?
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

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