How to truncate decimals in datagridview c # column?

2

I have a DataGrid that receives your information from the database through an SP, in one of the fields, I need to truncate to two decimals instead of rounding it up so that if I have a value as 99.9999578 , stay in 99.99 and do not round to 100 .

I tried a custom format ##0.00#### and MaxInputLength to try to limit the characters shown in the cell but it did not work.

    
asked by Camilo Leal Zárate 31.08.2018 в 19:59
source

1 answer

4

Try giving this format to the column

dataGridView1.Columns["TuColumna"].DefaultCellStyle.Format = "N2";
    
answered by 31.08.2018 / 20:05
source