Ken,
I havent created a custom grid, therefore i havent used
DataGridTextBoxColumn. I am
directly taking the column schema information from the database itself.
Am i right in saying that, if i havent created custom grid, i cant use
formatInfo property because it is available only in DataGridTextBoxColumn
Therfore, is their any other way.
Thanks for ur reply
Irfan
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:un*************@TK2MSFTNGP09.phx.gbl...
Hi,
Use a numberformatinfo. This is how to get a datagrid to display 1
digit after the decimal. Place this in your tablestyle for the grid.
Dim cm As CurrencyManager = CType(Me.BindingContext(DataGrid1.DataSource),
CurrencyManager)
Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("Qty")
Dim ni As New System.Globalization.NumberFormatInfo
ni.NumberDecimalDigits = 1
Dim colQty As New DataGridTextBoxColumn(pd, "f")
With colQty
.MappingName = "Col1"
.HeaderText = "Qty"
.Width = 75
.FormatInfo = ni
End With
Ken
------------------------------
"Irfan" <ir***@asc-ltd.co.uk> wrote in message
news:es**************@tk2msftngp13.phx.gbl...
hi,
When i access data from Access and place it in datagridview, the values
are
not rounded off.
For example: In access i can see the value as 5.7 but when it is shown on
the grid it is 5.99999999
Does anyone know a method as to how to round it off to two decimal places
only.
I want to apply this roundoff property to specific columns only not to the
whole datagridview.
something like datagridview.columns(0).round(...).
TIA