We help IT Professionals succeed at work.

Formatting numbers in a datagrid

rwheeler23
rwheeler23 asked
on
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).
Comment
Watch Question

CERTIFIED EXPERT
Commented:
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"

Regards,

Wayne

Explore More ContentExplore courses, solutions, and other research materials related to this topic.