tags:

views:

19

answers:

2

MY scenario is... I have 6,000 datas in Excel Sheet.. I try to import to Access Database.It enters the Database like this..

UNit Price 34512.00 Vat 4.00

BUt when i Retrieve to DataGridColumn it Shows vat Rate as 4(whole number).I accept zeros has no values..But I need that to be displayed in Grid as 4.0 . How to achieve this

A: 

I'm quite confused about the combination of tags c and datagridview, but I'm going to assume by the second tag you mean .NET WinForms DataGridView. In which case, you'll want to play with the Format property of the DataGridViewColumn to force it to show decimal places.

lc
for (i = 0; i < dt.Rows.Count; i++){ dvgproductlist.Rows[i].Cells[7].Value = dt.Rows[i]["UnitPrice"].ToString();}This how i retrieve values from access Database to gridview..How can enable here the Format PROPERTY.
Shiny
In that case, you want to use the built-in format capabilities of `ToString`. In this case, maybe something like `ToString("F1")` which will display as `4.0`.
lc
+1  A: 

Use a format string, here is some reference Standard Numeric Format Stings

alejandrobog
or (i = 0; i < dt.Rows.Count; i++) { dvgproductlist.Rows[i].Cells[7].Value = dt.Rows[i]["UnitPrice"].ToString(); } This how i retrieve values from access Database to gridview.. How can enable here the Format PROPERTY.How to achieve this
Shiny
+1 for the reference link.
lc