4.3.12

Operator cannot be applied to operands of type decimal' and 'double'

Once I tried to compare my string with the a decimal value. I got an error indicating the decimal value cannot be compared.


(Convert.ToInt(txt_LowerBound.Text) < 0.001))... Resolved by changing the conversion
(Convert.ToDecimal(txt_LowerBound.Text) < 0.001))
 
Now, I got the next error message.

 
The final change to get this condition work is as below,
 

(Convert.ToDecimal(txt_LowerBound.Text) < 0.001M))

Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech
Operator '<' cannot be applied to operands of type decimal' and 'double'

No comments:

Post a Comment