gwosgood
asked on
Displaying negative values in a DataGridView object using .DefaultCellStyle.Format
Greetings Experts,
I have a DataGridView object on my form that is linked to a dataTable populated based on a variable SQL query. I use the DefaultCellStyle.Format and Alignment properties based on the datatype of the column to adjust the display style for the end user.
DataGridView1.Columns.Item ("InvoiceA mt").Width = 90
DataGridView1.Columns.Item ("InvoiceA mt").Defau ltCellStyl e.Alignmen t = DataGridViewContentAlignme nt.MiddleR ight
DataGridView1.Columns.Item ("InvoiceA mt").Defau ltCellStyl e.Format = "c" 'currency
My problem comes with the way that negative values are displayed with the .DefaultCellStyle.Format value set to "c" for currency. For some reason, it places negative values within parenthesis, i.e. ($2250.45) instead of -$2250.45
Is there a way I can fix this to properly display the information? Any suggestions and help are appreciated. Thank you in advance.
I have a DataGridView object on my form that is linked to a dataTable populated based on a variable SQL query. I use the DefaultCellStyle.Format and Alignment properties based on the datatype of the column to adjust the display style for the end user.
DataGridView1.Columns.Item
DataGridView1.Columns.Item
DataGridView1.Columns.Item
My problem comes with the way that negative values are displayed with the .DefaultCellStyle.Format value set to "c" for currency. For some reason, it places negative values within parenthesis, i.e. ($2250.45) instead of -$2250.45
Is there a way I can fix this to properly display the information? Any suggestions and help are appreciated. Thank you in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I appreciate your quick response, thank you very much.