We help IT Professionals succeed at work.

vb.net money digit

XK8ER
XK8ER used Ask the Experts™
on
hello there,
how can I convert this string into money..

1516.49

into

$15.16
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
txt.Text = Decimal.Round(yoursting, 2).ToString("f2")
kaufmedGlanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Dim result As String = decimalValue.ToString("C")

Open in new window


Where "decimalValue" is of type Decimal.
Commented:
Agree with kaufmed, but suggest that you need to convert from string to decimal and divide by 100 prior to formatting using the currency format specifier:

        Dim MyString As String = "1516.49"
        Dim dec As Decimal = CDec(MyString) / 100
        MsgBox(dec.ToString("c"))

Open in new window

kaufmedGlanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Ha! I missed that the decimal point was being shifted to the left. An interesting requirement indeed  = )