• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Formatting numbers in a datagrid

I have datagrid displaying data from a SQL table. The columns are mix of string and numbers. The numbers are defined as demical(19,5). When they appear on the screen I would like 1245.67000 to appear as $1,245.67. The user has the ability to change the value so it needs to appear in money format on the screen. The finally when the changed data is comiited to the table I need it converted back to decimal(19,5).
1 Solution
Wayne Taylor (webtubbs)AstronautCommented:
Hi rwheeler23,

You can either set the Format property of the columns DefaultCellStyle at design time, or use code like this....

    DataGridView1.Columns("Column Name").DefaultCellStyle.Format = "$#,##0.00"



Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now