IDataGridViewEditingControl.EditingControlFormattedValue Özellik

Tanım

Düzenleyici tarafından değiştirilen hücrenin biçimlendirilmiş değerini alır veya ayarlar.

public:
 property System::Object ^ EditingControlFormattedValue { System::Object ^ get(); void set(System::Object ^ value); };
public object EditingControlFormattedValue { get; set; }
member this.EditingControlFormattedValue : obj with get, set
Public Property EditingControlFormattedValue As Object

Özellik Değeri

Object

Object Hücrenin biçimlendirilmiş değerini temsil eden.

Örnekler

Aşağıdaki kod örneği bu üyenin bir uygulamasını sağlar. Bu örnek, Nasıl yapılır: Windows Forms DataGridView Hücrelerinde Denetimleri Barındırma bölümünde bulunan daha büyük bir örneğin parçasıdır.

// Implements the IDataGridViewEditingControl.EditingControlFormattedValue 
// property.
public object EditingControlFormattedValue
{
    get
    {
        return this.Value.ToShortDateString();
    }
    set
    {            
        if (value is String)
        {
            try
            {
                // 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);
            }
            catch
            {
                // In the case of an exception, just use the 
                // default value so we're not left with a null
                // value.
                this.Value = DateTime.Now;
            }
        }
    }
}
Public Property EditingControlFormattedValue() As Object _
    Implements IDataGridViewEditingControl.EditingControlFormattedValue

    Get
        Return Me.Value.ToShortDateString()
    End Get

    Set(ByVal value As Object)
        Try
            ' This will throw an exception of the string is 
            ' null, empty, or not in the format of a date.
            Me.Value = DateTime.Parse(CStr(value))
        Catch
            ' In the case of an exception, just use the default
            ' value so we're not left with a null value.
            Me.Value = DateTime.Now
        End Try
    End Set

End Property

Açıklamalar

Biçimlendirilmiş değer, denetimin kullanıcı arabiriminde görüntülenen değeri temsil eder. Biçimlendirilmiş değer, mutlak değerde ve hatta veri türünden denetimde yer alan gerçek değerden farklı olabilir.

Şunlara uygulanır

Ayrıca bkz.