Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IDataGridViewEditingControl.EditingControlFormattedValue Property

Gets or sets the formatted value of the cell being modified by the editor.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

Object EditingControlFormattedValue { get; set; }

Property Value

Type: System.Object
An Object that represents the formatted value of the cell.

The formatted value represents the value as it is displayed in the control's user interface. The formatted value may be different in absolute value and even data type from the actual value contained in the control.

The following code example provides an implementation of this member. This example is part of a larger example available in How to: Host Controls in Windows Forms DataGridView Cells.

// Implements the IDataGridViewEditingControl.EditingControlFormattedValue 
// property.
public object EditingControlFormattedValue
        return this.Value.ToShortDateString();
        if (value is String)
                // This will throw an exception of the string is 
                // null, empty, or not in the format of a date.
                this.Value = DateTime.Parse((String)value);
                // In the case of an exception, just use the 
                // default value so we're not left with a null
                // value.
                this.Value = DateTime.Now;

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft