TypeValidationEventArgs.IsValidInput 속성

정의

서식이 지정된 입력 문자열이 유효성 검사 형식으로 성공적으로 변환되었는지 여부를 나타내는 값을 가져옵니다.

public:
 property bool IsValidInput { bool get(); };
public bool IsValidInput { get; }
member this.IsValidInput : bool
Public ReadOnly Property IsValidInput As Boolean

속성 값

서식이 지정된 입력 문자열이 ValidatingType 속성에 지정된 형식으로 변환될 수 있으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다. 예제에서는 이벤트 처리기에서 보고서를 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

설명

IsValidInput 속성의 성공 여부를 나타냅니다는 Parse 메서드는 Type 표시를 ValidatingType 속성. 이 형식에 있어야 Parse 메서드 하나 또는 둘 다 다음 서명 중:

public static Object Parse(string)

public static Object Parse(string, IFormatProvider)

Parse 전에 호출 되는 MaskedTextBox 를 발생 시킵니다는 TypeValidationCompleted 이벤트입니다. 내용을 프롬프트 문자를 제외를 사용 하 여이 메서드가 호출 되는 Text 의 속성은 MaskedTextBox 클래스. 성공 하면 변환된 된 개체를 반환 합니다. 그러지 않으면 반환 null합니다.

형식 유효성 검사 프로세스에 대 한 자세한 내용은 참조는 TypeValidationCompleted 이벤트입니다.

적용 대상

추가 정보