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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sam112 reputationPosted Aug 1, 2007, 3:30 AM EDT
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
AlanRank #669 · 3.6K reputationPosted Aug 1, 2007, 5:12 AM EDT
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")