Click here to Skip to main content
16,021,449 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hello. I have a vb.net windows forms application that is using a datagridview. I'm hoping to find a simple way to format certain datagridview cells numbers to 3 decimal places. This is what I have so far, but it doesn't seem to format everything correctly.

DataGridView1.Columns(2).DefaultCellStyle.Format = "#.###"
Posted
Comments
CHill60 18-Nov-13 11:54am    
How are you assigning values into the DataGridView cells?
And what do you mean by "doesn't seem to format everything correctly" - can you give an example?

1 solution

Hi CAS1224, have you tried this
C#
Me.DataGridView1.Columns(2).DefaultCellStyle.Format = "n3"

try this, hope this works

Thanks
Ganesh
 
Share this answer
 
v4

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