Ghanisen
asked on
Decimals and thousands separators in a numeric DataGrid Column
Hi,
I’d like column1 of my datagrid to be formatted to display numbers with a fixed number of decimals (e.g. 1, 2 or 3) and yet be formatted with thousands separators.
Does anyone know how to do that?
To format with thousands separators this is the code I use but it doesn’t allow for decimals:
Dim dgTextBoxColumn1 As DataGridTextBoxColumn = MyDataGrid.TableStyles("tP roduits"). GridColumn Styles("My Column")
dgTextBoxColumn1.Format = "#,#"
Any help shall be greatly appreciated.
I’d like column1 of my datagrid to be formatted to display numbers with a fixed number of decimals (e.g. 1, 2 or 3) and yet be formatted with thousands separators.
Does anyone know how to do that?
To format with thousands separators this is the code I use but it doesn’t allow for decimals:
Dim dgTextBoxColumn1 As DataGridTextBoxColumn = MyDataGrid.TableStyles("tP
dgTextBoxColumn1.Format = "#,#"
Any help shall be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
My question wasn't about currency data but only plain numeric data. So it should be "n" instead of "c".
I found also another way to do it with a custom format:
Dim dgTextBoxColumn6 As DataGridTextBoxColumn = _
dgr.TableStyles("tProduits
GridColumnStyles("QuantSto
' Format avec séparateur de milliers prédéfini
dgTextBoxColumn6.Format = "#.#0,000"
The number of 0 after the coma determines the number of decimals. It works.
Thank you for your effort. You still deserve 500 points. Bye Iboutchkine.