Hi, I'm trying to store a new value within a variable and then compare it to the previous value of that variable using the Math.Min method. I have created two seperate variable 1 for the previous and one for the new but I can't seem to store it. They both keep coming up with the same amount. Any suggestions would be appreciated.
mikeandike
0
Newbie Poster
Recommended Answers
Jump to PostThat would be expected for reference types, but not for value types. Sounds like it could be an order-of-operation problem, don't you think? Post the code, let's see what's going on.
Jump to PostDim decSubtotal As Decimal Dim decDiscountPercent As Decimal = 0.25D Dim decDiscountAmount As Decimal Dim decInvoiceTotal As Decimal Dim decSmallestInvoiceTotal As Decimal decSubtotal = CDec(txtEnterSubtotal.Text) decDiscountAmount = Math.Round(decSubtotal * decDiscountPercent, 2) decInvoiceTotal = decSubtotal - decDiscountAmount decSmallestInvoiceTotal = Math.Min(decSmallestInvoiceTotal, decInvoiceTotal) 'comparison of stored value and next input …
All 5 Replies
apegram
302
LINQ!
Team Colleague
mikeandike
0
Newbie Poster
StuartMillner
0
Light Poster
mikeandike
0
Newbie Poster
StuartMillner
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.