-
May 20th, 2010, 01:19 PM
#1
DataGridViewRow Problem (Formatting not updating)
I am having problems with my DataGridView.
I have two colums in this row. Text, and Cost. In the cost Column, I have the DefaultCellStyle Format set to C2 (As a number).
When I add rows (DataGridView.Rows.Add("Text", "5")), it formats it correctly as $5.00 (In the Cost Column).
The problem I am having is on an update. I want to be able to format the row correctly when a user edits the row. When I edit the row, DataGridView_CellEndEdit shows me the value "5", but not the correctly formatted value, nor can I update the format for the user.
How would I update the format?
-
May 23rd, 2010, 10:21 AM
#2
Re: DataGridViewRow Problem (Formatting not updating)
Something like myDataGridView(int col,int row).Value = String.Format("{0:C}", myDataGridView(int col, int row).Value)
???
-
May 23rd, 2010, 08:38 PM
#3
Re: DataGridViewRow Problem (Formatting not updating)
Would this go into the Cell Validating Method, or CellEndEdit.
I just don't understand why it doesn't update the format. The Cell Inherited style should see that it should be formatted as "C2", don't understand why I have to manually update it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|