IDataGridViewEditingControl.EditingControlFormattedValue 속성

정의

편집기에서 수정할 셀의 형식이 지정된 값을 가져오거나 설정합니다.

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

속성 값

Object

형식이 지정된 셀 값을 나타내는 Object입니다.

예제

다음 코드 예제에는이 멤버의 구현을 제공 합니다. 이 예제는에서 사용할 수 있는 보다 큰 예제의 일부 방법: Windows Forms DataGridView 셀에서 컨트롤을 호스트합니다.

// 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

설명

형식화 된 값을 컨트롤의 사용자 인터페이스에 표시 되는 값을 나타냅니다. 형식화 된 값을 컨트롤에 포함 된 실제 값에서 절대 값 및 데이터 형식과 다를 수 있습니다.

적용 대상

추가 정보