DataRepeaterDataErrorEventArgs.PropertyName 属性

获取控件的属性的名称会引发该错误。

命名空间:  Microsoft.VisualBasic.PowerPacks
程序集:  Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

语法

声明
Public ReadOnly Property PropertyName As String
public string PropertyName { get; }
public:
property String^ PropertyName {
    String^ get ();
}
member PropertyName : string
function get PropertyName () : String

属性值

类型:System.String
属性的名称。

备注

DataError 事件使您能够在数据操作过程中,代码引发由 DataRepeater 控件调用的异常。

PropertyName 属性包含导致错误属性的名称。 在大多数情况下,它是控件的 Text 属性。 PropertyName 可用于提示用户更正的或写入到错误日志。

示例

数据,则错误时,下面的示例演示如何使用从 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)