Results 1 to 5 of 5

Thread: how to put comma in decimal value .pls help me!!!

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    11

    Question how to put comma in decimal value .pls help me!!!

    helo guys..i'am soo new in vb.net..i have a problem like this..how to convert decimal value like 100000 to 100,000(put comma).

    before it i have used this code

    .Selection.TypeText(Text:=value.ToString("N"))
    but it's output is 100,000.00. so i dun want .00 include too, i want the output 100,000 only..

    i hope u all out there can help me..thanks a lots

  2. #2
    Member
    Join Date
    Mar 2004
    Posts
    53
    Hello gigs,

    if I were you I'd use the Formatnumber method to do this...

    for example:

    Code:
    Dim i As Double = Val(TextBox1.Text)
    Label1.Text = FormatNumber(i, 0, , , TriState.True)
    the "0" in the FormatNumber(i, 0, , , TriState.True) method sets for 0 numbers to be shown after the decimal.

    Hope that helps

  3. #3
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    VB Code:
    1. Label1.Text = Format(Label1.Text, "##,###")

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    11

    Wink thanks

    thanks a lot to DEWWD and pvbangera .i will try my best..


  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Use the .Format method of the .Net String class.
    VB Code:
    1. Dim s As Decimal = 10330000.15D
    2. MessageBox.Show(String.Format("{0:#,###}", s))

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