Results 1 to 3 of 3

Thread: How to Place Values Containing Commas in integer

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Posts
    11

    How to Place Values Containing Commas in integer

    helo guys, i am so new in VB.net..now i have a problems..i have sent before it but have no reply..so my problem is how to place the values containing commas when i print it, example

    in my database =100000 but when i print i want 100,000

    before it i have use this code

    .Selection.TypeText(Text:=Cert.ToString("N"))
    but the output when i print is 100,000.00. so i dun want .00 come out. i hope anyelse out there can give me the solution..tq a lots

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    ALl you have to do is select what you want out of the string:
    VB Code:
    1. Dim num As String = "100,000,000.00"
    2.  
    3. num = Microsoft.VisualBasic.Left(num, Len(num)-2)

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    "in my database =100000 but when i print i want 100,000"

    Then 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