Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2009, 04:43 PM
Registered User
 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting an integer as 123,456

Does anyone know how to format an integer to include comma formatting? I.e. 123456 to 123,456.

I am populating a gridview from a code behind page in VB and using the code below to do some formatting, but cannot seem to figure out how to put in the commas in my numeric values.

Thanks!

'.... Formatting the rows. .................................................. ...............
If e.Row.RowType = DataControlRowType.DataRow And e.Row.Cells(1).Text <> "Totals"Then
x = 1
DoUntil x > 13
e.Row.Cells(x).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(x).Wrap =
"False"
e.Row.Cells(x).Font.Name = "verdana"
e.Row.Cells(x).Font.Size = FontUnit.Point(10)
e.Row.Cells(x).BackColor = Drawing.Color.AliceBlue
x = x + 1
Loop
EndIf
 
Old May 20th, 2009, 03:36 PM
Registered User
 
Join Date: May 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default OK, I figured it out

DataFormatString="{0:c}" or in the GridView Tasks box that is available when in Design View select "Edit Columns" then select the column you need to format and type {0:N0} in the "DataFormatString" field





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Error, p. 456, step 16 member4953 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 April 8th, 2009 01:19 PM
Ch 12, Try It Out, p.456, Line 8 Different result VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 23rd, 2006 02:52 PM
formatting integer field gloribel Crystal Reports 1 October 13th, 2005 12:27 PM
123 IN LUCK C# 0 April 3rd, 2005 09:12 PM
Lotus 123 Workbook helga Pro VB 6 1 September 20th, 2004 08:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.