views:

28

answers:

1

I have datas as unitprice with 10 decimal places in access database. I want those decimal places to reduce when it comes to datagridview(round to 2 places). How can i achieve this. Any idea.

Thanks in advance

A: 

You could round it when retrieving it, but I would recommend to round only the displayed value (because you might need the original value for some calculus).

So here is how you format the first column to round to 2:

grid.Columns(0).DefaultCellStyle.Format = "D2";

thelost
Your code remains the same.No changedvgproductlist.Rows[i].Cells[6].Value = dt.Rows[i]["UnitIncCustom"].ToString(); This how the code retrieve datas from access to gridview
Shiny
sorry, I don't get you
thelost