Click here to Skip to main content
13,094,732 members (96,465 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 24 May 2014

EditedFormattedValue v/s Value in Datagridview

, 24 May 2014
Rate this:
Please Sign up or sign in to vote.
There is usually a mis-conception with people thinking "DataGridView Cell.Value" gets the current value of the cell in datagridview. This article will tell you the difference between "EditedFormattedValue v/s Value in Datagridview".


This tip will help developers to understand how to retrieve current exact value from datagridview cell.

DataGridViewCell.Value Property

"DataGridViewCell.Value" or "Value" 's function is to get or set the value of the associated cell but there is a problem with the Property "Value" viz., every time you leave the cell, formatting is needed to display the content on the user interface. While you use "Value", sometimes it does not format the content of the cell and when you try to retrieve the data like this:

string str = datagridview1.Rows[0].Cells[0].Value.ToString();  


You might get some previously written data or null value.

DataGridViewCell.EditedFormattedValue Property

"DataGridViewCell.EditedFormattedValue" Or "EditedFormattedValue" 's function is to get the current, formatted value of the cell, regardless of whether the cell is in the edit mode and the value has not been committed. EditedFormattedValue ensures that the value is committed or saved at every point of coding. You can use the property like this:

string str = dataGridView1.Rows[0].Cells[0].EditedFormattedValue.ToString();


This will give you the current exact value of the dataGridView's cell.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
India India
No Biography provided

You may also be interested in...


Comments and Discussions

SuggestionClarification on EditedFormattedValue Pin
Member 215083926-May-14 12:39
memberMember 215083926-May-14 12:39 
GeneralRe: Clarification on EditedFormattedValue Pin
Agent_Spock26-May-14 19:42
professionalAgent_Spock26-May-14 19:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 24 May 2014
Article Copyright 2014 by agent_kruger
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid