BindingCompleteEventArgs.BindingCompleteState 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得繫結作業的完成狀態。
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
屬性值
其中一個 BindingCompleteState 值。
範例
下列程式碼範例示範此成員的使用。 在此範例中,事件處理常式會報告事件發生次數 Binding.BindingComplete 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 MessageBox.ShowConsole.WriteLine 為 或將訊息附加至多行 TextBox 。
若要執行範例程式碼,請將它貼到包含名為 Binding1
之型 Binding 別實例的專案。 然後,確定事件處理常式與事件相關聯 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
備註
BindingCompleteState使用 來判斷系結是否成功,或發生錯誤或例外狀況。