BindingManagerDataErrorEventArgs.Exception 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public:
property Exception ^ Exception { Exception ^ get(); };
public Exception Exception { get; }
member this.Exception : Exception
Public ReadOnly Property Exception As Exception
屬性值
範例
下列程式碼範例示範如何使用這個成員。 在此範例中,事件處理常式會報告事件的發生次數 BindingManagerBase.DataError 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 MessageBox.Show 為 Console.WriteLine 或將訊息附加至多行 TextBox 。
若要執行範例程式碼,請將它貼入包含繼承自 BindingManagerBase 之型別實例的專案,例如 PropertyManager 或 CurrencyManager 。 然後命名 實例 BindingManagerBase1
,並確定事件處理常式與 事件相關聯 BindingManagerBase.DataError 。
private void BindingManagerBase1_DataError(Object sender, BindingManagerDataErrorEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Exception", e.Exception);
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "DataError Event");
}
Private Sub BindingManagerBase1_DataError(sender as Object, e as BindingManagerDataErrorEventArgs) _
Handles BindingManagerBase1.DataError
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "Exception", e.Exception)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"DataError Event")
End Sub
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應