Aracılığıyla paylaş


TypeValidationEventArgs.ValidatingType Özellik

Tanım

Biçimlendirilmiş giriş dizesinin doğrulandığı türü alır.

public:
 property Type ^ ValidatingType { Type ^ get(); };
public Type ValidatingType { get; }
public Type? ValidatingType { get; }
member this.ValidatingType : Type
Public ReadOnly Property ValidatingType As Type

Özellik Değeri

Dönüştürme işleminin hedefi Type . Bu hiçbir zaman olmamalıdır null.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu MaskedTextBox.TypeValidationCompleted bildirir. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile MessageBox.Show değiştirmeyi Console.WriteLine veya çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı MaskedTextBoxtürünün MaskedTextBox1 bir örneğini içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden MaskedTextBox.TypeValidationCompleted emin olun.

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

Açıklamalar

Doğrulama işlemi yalnızca sınıfının özelliği MaskedTextBox değilse nullgerçekleşirMaskedTextBox.ValidatingType. ValidatingType özelliği, dönüştürme işleminin hedef türünü temsil eden aynı türe başvurur.

Şunlara uygulanır

Ayrıca bkz.