Hi,
I get a number from an excel and assign it in a variable. My variable has 2 decimals. I need to write this variable with 2 decimals in some places of a web page but sometimes I need to write with 3 decimals.
How can I do that?
Thanks.
1 Like
HI @makboga
Checkout this expression
For two decimals
CDec("2435.1256").ToString("#.00")
For three decimals
CDec("2435.1256").ToString("#.000")
Regards
Sudharsan
I get the error that says "Option Strict On disallows implicit conversions from ‘String’ to ‘Double’. "
How can I fix this?
Yes I tried and I get this error.
Hi @makboga ,
Could you show us the Input value and How it needs to be typed into the webpage when done manually?
Your value is a string, so you can’t use the .ToString(“F3”) on it. That only works on variables with datatype Double. So you need to convert to Double first:
CDbl(yourStringVal).ToString(“F3”)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.