Sdílet prostřednictvím


BindingCompleteEventArgs.ErrorText Vlastnost

Definice

Získá textový popis chyby, ke které došlo během operace vazby.

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

Hodnota vlastnosti

Textový popis chyby, ke které došlo během operace vazby.

Příklady

Následující příklad kódu ukazuje použití tohoto člena. V tomto příkladu obslužná rutina události hlásí výskyt Binding.BindingComplete události. Tato sestava vám pomůže zjistit, kdy k události dojde, a může vám pomoct při ladění. Chcete-li hlásit více událostí nebo událostí, ke kterým dochází často, zvažte nahrazení MessageBox.ShowConsole.WriteLine nebo připojení zprávy do víceřádkového řetězce TextBox.

Pokud chcete spustit ukázkový kód, vložte ho do projektu, který obsahuje instanci typu Binding s názvem Binding1. Potom se ujistěte, že je obslužná rutina události přidružená k Binding.BindingComplete události.

private void Binding1_BindingComplete(Object sender, BindingCompleteEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Binding", e.Binding );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "BindingCompleteState", e.BindingCompleteState );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "BindingCompleteContext", e.BindingCompleteContext );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Exception", e.Exception );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "BindingComplete Event" );
}
Private Sub Binding1_BindingComplete(sender as Object, e as BindingCompleteEventArgs) _ 
     Handles Binding1.BindingComplete

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Binding", e.Binding)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "BindingCompleteState", e.BindingCompleteState)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "BindingCompleteContext", e.BindingCompleteContext)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Exception", e.Exception)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"BindingComplete Event")

End Sub

Poznámky

Tato vlastnost vrátí prázdný řetězec, pokud v operaci vazby nedošlo k žádné chybě. Vrátí hodnotu Exception.Message vlastnosti, když dojde k výjimce.

Platí pro