Compare non decimal number with decimal number


I think I have tried about anything except the solution.

I retrieve two string variables, one that might be a decimal number and one that always will be a decimal number.

The easy solution is to do an true/false on String=String, but with the decimals is always false.

I have tried Math.Round - Convert to Int - Convert to Double and Convert.ToDecimal, but none of them gives me the possibility to compare the two numbers.

3012,00 - 3012 should equal 0, but converting the numbers gives 301200 - 3012 = 298188 which is incorrect. I just want to verify that the two variables deducted is less than 1.

Convert both sides to Decimal or Double and perform your actions. it will work

I have already tried Cdbl on both values, but that gives me 301200 and 3012 which is not correct.

Convert the , in the value to a . first then try to convert to decimal :slight_smile:

replace the value of , to . and then perform

Replacing the , did the trick. Now I get the wanted solution.

Thanks for the help.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.