Posted on 2014-01-17
hello I am having trouble figuring out a method to compare two values that seem to be the same, but the number of decimal places is affecting the logic and I am not sure how to format the values correctly.
One of the values is an entity record field = 100.00000000000000000000
The other value is from a detailsview cell = 100.00
When I run this code:
If String.Equals(myHistoryRecipeRecord.MeltPointHigh, DirectCast(dvRecipeItem.Rows(6).Cells(1).Controls(0), TextBox).Text) Then
strRefineRecipeRecord.Append("MeltPointHigh: " & myHistoryRecipeRecord.MeltPointHigh & ", ")
strRefineRecipeRecord.Append("MeltPointHigh: Old= " & myHistoryRecipeRecord.MeltPointHigh &
", New= " & DirectCast(dvRecipeItem.Rows(6).Cells(1).Controls(0), TextBox).Text & ", ")
It always fall to the else because the number of decimal places.
I have search for examples on how to format decimals coming from an entity record field, but I have not found anything that I can understand.
If any one could please explain to me how this can be done, that would be great.
Thank you so much.