共用方式為


DataRepeaterDataErrorEventArgs.Control 屬性

取得引發資料錯誤的 Control

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
Public ReadOnly Property Control As Control
public Control Control { get; }
public:
property Control^ Control {
    Control^ get ();
}
member Control : Control with get
function get Control () : Control

屬性值

類型:Control
引發錯誤的控制項。

備註

DataError 事件可讓您處理在資料處理作業期間,會擲回在程式碼中由 DataRepeater 控制項所呼叫的例外狀況。

Control 屬性包含發生錯誤之 DataRepeaterItem 的控制項。

範例

在發生資料錯誤時,下列範例會示範如何從 DataRepeaterDataErrorEventArgs 資料顯示訊息。

Private Sub DataRepeater1_DataError(
    ByVal sender As Object, 
    ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterDataErrorEventArgs
  ) Handles DataRepeater1.DataError

    Dim ErrorMsg As String 
    ' Create an error string.
    ErrorMsg = "Invalid value entered for " & e.Control.Name & ". "
    ErrorMsg = ErrorMsg & e.Exception.Message
    ' Display the error to the user.
    MsgBox(ErrorMsg)
    ' Do not raise an exception.
    e.ThrowException = False 
End Sub
private void dataRepeater1_DataError(object sender, 
    Microsoft.VisualBasic.PowerPacks.DataRepeaterDataErrorEventArgs e)
{
    string ErrorMsg;
    // Create an error string.
    ErrorMsg = "Invalid value entered for " + e.Control.Name + ". ";
    ErrorMsg = ErrorMsg + e.Exception.Message;
    // Display the error to the user.
    MessageBox.Show(ErrorMsg);
    // Do not raise an exception.
    e.ThrowException = false;
}

.NET Framework 安全性

請參閱

參考

DataRepeaterDataErrorEventArgs 類別

Microsoft.VisualBasic.PowerPacks 命名空間

DataError

其他資源

DataRepeater 控制項簡介 (Visual Studio)