CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Format Problem

  1. #1
    Join Date
    Jan 2003
    Location
    India
    Posts
    9

    Format Problem

    Hi!
    I need a number to be Formated as user defines.But Vb's Format command does not do anything.

    I need the number to format like this:

    #,##,##0.00

    But Vb's format function returs me in the format

    ###,##0.00

    Can I get the above format by Vb's format function if yes how?

    Thanks

  2. #2
    Join Date
    Aug 2001
    Posts
    1,447
    the VB help implies (obviously incorrectly) that you can do what you are trying to do, but you can't, so you'll have to roll your own. Check on planetsourcecode; maybe someone has already done it.
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125
    I do not see where the VB information would imply any such thing, the comma character is explicitly stated as the THOUSANDS seperator.

    The ',' character serves two purposes. First, if the format string contains a ',' character between two digit placeholders (0 or #) and to the left of the decimal point if one is present, then the output will have thousand separators inserted between each group of three digits to the left of the decimal separator. The actual character used as the decimal separator in the output string is determined by the NumberGroupSeparator property of the current NumberFormatInfo object that controls formatting.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4
    Join Date
    Aug 2001
    Posts
    1,447
    I do not see where the VB information would imply any such thing
    you are obviously correct. I didn't read the verbiage and misinterpreted the code. Thank you for point it out. The only thing I hate more than being wrong is being wrong and not knowing it.
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured