Kevin Rodriguez
Kevin Rodriguez

Reputation: 127

How can I display decimal data as whole numbers in a DataGridView?

How can I convert this column into a whole number instead of a decimal?

enter image description here

Upvotes: 0

Views: 677

Answers (2)

Grant Winney
Grant Winney

Reputation: 66509

After setting the DataSource for your DataGridView, specify the numeric format of that column:

dataGridView1.Columns["age"].DefaultCellStyle.Format = "N0";

Upvotes: 1

CindyH
CindyH

Reputation: 3026

Well, I'm not sure exactly where your code is, but in general you'd say Convert.ToInt32(age)

Upvotes: 0

Related Questions