TypeValidationEventArgs.ReturnValue 속성

정의

서식이 지정된 입력 문자열의 변환 결과를 나타내는 개체를 가져옵니다.

public:
 property System::Object ^ ReturnValue { System::Object ^ get(); };
public object ReturnValue { get; }
public object? ReturnValue { get; }
member this.ReturnValue : obj
Public ReadOnly Property ReturnValue As Object

속성 값

유효성 검사에 성공하면 변환된 형식을 나타내는 Object이고, 그렇지 않으면 null입니다.

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다. 예제에서는 이벤트 처리기에서 보고서를 MaskedTextBox.TypeValidationCompleted 이벤트입니다. 이 보고서를 통해 이벤트 발생 하 고 도움이 될 수 있습니다 디버깅 하는 경우를 학습할 수 있습니다. 자주 발생 하는 이벤트 또는 여러 이벤트를 보고 하려면 바꾸는 것이 좋습니다 MessageBox.Show 사용 하 여 Console.WriteLine 줄에 메시지를 추가 또는 TextBox합니다.

예제 코드를 실행 하려면 형식의 인스턴스를 포함 하는 프로젝트에 붙여넣습니다 MaskedTextBox 라는 MaskedTextBox1합니다. 연결 된 이벤트 처리기는 확인 된 MaskedTextBox.TypeValidationCompleted 이벤트입니다.

private void MaskedTextBox1_TypeValidationCompleted(Object sender, TypeValidationEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsValidInput", e.IsValidInput );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Message", e.Message );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ValidatingType", e.ValidatingType );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "TypeValidationCompleted Event" );
}
Private Sub MaskedTextBox1_TypeValidationCompleted(sender as Object, e as TypeValidationEventArgs) _ 
     Handles MaskedTextBox1.TypeValidationCompleted

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "IsValidInput", e.IsValidInput)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Message", e.Message)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ValidatingType", e.ValidatingType)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"TypeValidationCompleted Event")

End Sub

설명

형식 유효성 검사 프로세스에 지정 된 형식에 프롬프트 문자를 포함 하지 않고 형식화 된 입력된 문자열을 변환 하려고 시도 합니다 ValidatingType 속성입니다. ReturnValue 속성은 변환 시도의 결과 나타내는 및에서 반환 되는 값에 해당 합니다 ValidateText 메서드의 MaskedTextBox 클래스.

적용 대상

추가 정보