locked
Formating a string in vb.net backend RRS feed

  • Question

  • User-234661480 posted

    Hi,

    I am having a problem in asp.net where i am trying to format a string. The string is in sql servers "money" format ( #.#### where theres serveral numbers before the "." and four after it) I need ti make the string to this format #.## (Several numbers before the "." and two after it)

    I have tried this:

    Dim strAmount As String = dr.Item("amount"'Where amount is the column in a table set to the "money" format

    Format(strAmount, "{0:#.##}")

    But it does not working (it simply returns #.####, like it was in the database)

    A little help here!!

    Saturday, August 2, 2008 1:51 AM

All replies

  • User-2116278700 posted

    Hi,

    Try this String.Format("{0:0.00}", yourValue);

    Saturday, August 2, 2008 2:28 AM