Learner
Learner

Reputation: 1376

How to control four decimal values to two from database money field c#

enter image description hereI want to append the dataSource to dataGridvIew from database which is having money fields as enter image description here

Here nrdc_ItemPrice and nrdc_Lntotl fields are appending to datagridview as shown in 1st image

How can I control them to .00 values. Here is my code

dsEstmDtls = salesDCCls.ordrAckDataSet(estmID);
dtDCDtls = dsEstmDtls.Tables[1];
dgvDcNon.DataSource = dtDCDtls;

Upvotes: 1

Views: 812

Answers (1)

Abdusalam Ben Haj
Abdusalam Ben Haj

Reputation: 5423

Change the DataGridView column format :

dgvDcNon.Columns["ColumnName"].DefaultCellStyle.Format = "N2";

You can do that from the designer as well. Example from the web :

enter image description here

Upvotes: 2

Related Questions