Reputation: 105
Datagridview is unbound. two columns contain numeric values and the C2 format is applied to those columns. The grid displays such as $3,200.00. I edit the value and move away from the cell. The end edit event fires and a routine is called to save the data to SQL. I would like to know how to return the cell to the currency format after the edit ends.
I have tried the suggestion in the suggested post with no success.
If I enter 1234 I expect it to display $1,234.00 but it displays 1234.
Upvotes: 0
Views: 591
Reputation: 11791
Based on your description, it sounds as though you did not set the column's ValueType
property. If you do not set this property, the default type is String
. Since you are displaying currency values, Decimal
would be the proper type to set.
DataGridView1.Columns(0).ValueType = GetType(Decimal)
Upvotes: 1