Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataColumn Decimal places

Status
Not open for further replies.

Johnblaze1

Programmer
Sep 17, 2002
25
US
Is there a way to set up a datacolumn of a datatable to only hold 2 decimal places? The value in this column is created by a datacolumn expression, and I'd like to limit the value to only 2 decimal places.

Thanks
 
Hello, have you looked at defining the datagrid? I used the following to set four decimal places.
Code:
        Dim TCColumn06 As New DataGridTextBoxColumn
        TCColumn06.MappingName = "Data1"
        TCColumn06.HeaderText = "Dollars"
        TCColumn06.Width = 70
        [b]TCColumn06.Format = "$#####0.0000"[/b]
        TCColumn06.NullText = 0
        TCColumn06.Alignment = HorizontalAlignment.Right
        TCColumn06.ReadOnly = True
        TSCombined.GridColumnStyles.Add(TCColumn06)
Note this is only part of a larger set of code
Good luck
djj
 
Thanks for the datagrid idea. I had been trying to do this at the datatable level since the datagrid's columns will change based on user supplied criteria.

Thanks

John
 
I had the same problem and that was when I found KB 319082 which gave the idea of mapping columns. Along the way I needed the format.
Glad I could help.
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top