Share via


TypeValidationEventArgs.Message Özellik

Tanım

Dönüştürme işlemini açıklayan bir kısa mesaj alır.

public:
 property System::String ^ Message { System::String ^ get(); };
public string Message { get; }
public string? Message { get; }
member this.Message : string
Public ReadOnly Property Message As String

Özellik Değeri

String Dönüştürme işleminin açıklamasını içeren.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu MaskedTextBox.TypeValidationCompleted raporlar. 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 Console.WriteLine değiştirmeyi MessageBox.Show veya iletiyi çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı MaskedTextBox1bir tür MaskedTextBox örneği 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, biçimlendirilmiş kullanıcı girişini özelliği tarafından tanımlanan türe dönüştürmeyi ValidatingType gerektirir. özelliği, Message dönüştürme işleminin metin açıklamasını içerir. Message dönüştürme başarısız olduğunda, bir özellik değeriyle IsValidInputfalsegösterildiği gibi öncelikli olarak yararlıdır.

Şunlara uygulanır

Ayrıca bkz.