Click here to Skip to main content
15,913,361 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi experts,

I have one query. it has some columns(Code,name,price,qty,amount).
The Amount columns displays:123456789.
My question is how can i display 123,456,789.00 in DataGridView(Amount Column)?
Will i format it in Query or format it in DataGridView?

Thanks

TONY
Posted

easy to set in gridview,
1>. For Design time
open columns 'DefaultCellStyle' Property -> Format -> Format type = Numeric

2>. For runtime
VB
DataGridView1.Columns(1).DefaultCellStyle.Format = "N2"

Happy Coding!
:)
 
Share this answer
 
v2
Comments
soeun tony 7-Aug-12 5:05am    
Hi aarti,
this way can be use when my datagrid already has columns.
but for my problem is that all value that display in datagridview will be shown when i click on Display Button.
It means that at design time my datagridview not yet set columns.
Thanks
TONY
Aarti Meswania 7-Aug-12 5:18am    
Try updated solution for runtime setting number format with comma separator.
try this
open columns 'DefaultCellStyle' Property -> Format -> Format type = Numeric or custom format
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900