Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,


In the Datagridview I have a column "C" which is product of Column "A" and "B". Example Column A Value = 8.14 Column B Value = 0.2 Now the column C value is 12.296 and after decimal I want to show first two numbers like 12.29 without rounding to 12.30.

Is there any simple way of setting the DefaultCellStyle.format for the Column C.

Thanks,
Prathap.
Posted

1 solution

You have three ways to do:
Searching on Google[^]...

Reading this article[^].

Or, reading this forum thread[^].

Regards.
 
Share this answer
 
Comments
Prathap Gangireddy 22-Jul-14 11:02am    
Thanks for the links .. Searching on google from past 4 hrs.. I am looking for something simpler one line code gvItemDetails.Columns["VAT Amount"].DefaultCellStyle.Format="0.00" instead of using cellformatting and customformatters.
Prathap Gangireddy 22-Jul-14 11:06am    
I guess Cellformatting implementation will affect performance.So looking for any alternative solution.

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