hi
i need to convert the given string into a decimal value
for eg:
if i input 1 it hould display 1.0
please suggest me a code in vb.net to do this conversion....
thank you
hi
i need to convert the given string into a decimal value
for eg:
if i input 1 it hould display 1.0
please suggest me a code in vb.net to do this conversion....
thank you
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Aug 1, 2007, 9:12 AM
Having parsed your string to a decimal, you'll still need to apply formatting to get it to display to one decimal place. This should do it:
Dim decStr As String = "1"
Dim dec As Decimal = Decimal.Parse(decStr)
decStr = dec.ToString("0.0")
SamPosted Aug 1, 2007, 7:30 AM
To Convert a string to a double can can use
the Double.Parse method it takes a string and returns
a double value
Hope this helps,
Sam