BindingCompleteEventArgs.BindingCompleteState Właściwość

Definicja

Pobiera stan ukończenia operacji powiązania.

public:
 property System::Windows::Forms::BindingCompleteState BindingCompleteState { System::Windows::Forms::BindingCompleteState get(); };
public System.Windows.Forms.BindingCompleteState BindingCompleteState { get; }
member this.BindingCompleteState : System.Windows.Forms.BindingCompleteState
Public ReadOnly Property BindingCompleteState As BindingCompleteState

Wartość właściwości

BindingCompleteState Jedna z wartości.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego elementu członkowskiego. W tym przykładzie program obsługi zdarzeń zgłasza wystąpienie Binding.BindingComplete zdarzenia. Ten raport pomaga dowiedzieć się, kiedy wystąpi zdarzenie, i może pomóc w debugowaniu. Aby zgłosić wiele zdarzeń lub często występujących zdarzeń, rozważ zastąpienie MessageBox.Show komunikatu ciągiem Console.WriteLine lub dołączenie go do wielowierszowego TextBoxelementu .

Aby uruchomić przykładowy kod, wklej go w projekcie zawierającym wystąpienie typu Binding o nazwie Binding1. Następnie upewnij się, że program obsługi zdarzeń jest skojarzony ze zdarzeniem Binding.BindingComplete .

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

Uwagi

Użyj elementu , BindingCompleteState aby określić, czy powiązanie zakończyło się pomyślnie, czy wystąpił błąd lub wyjątek.

Dotyczy