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
Available since 2.0
Return to top