DataRepeaterDataErrorEventArgs 类
为 DataError 事件提供数据。
继承层次结构
System.Object
System.EventArgs
Microsoft.VisualBasic.PowerPacks.DataRepeaterDataErrorEventArgs
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
Public Class DataRepeaterDataErrorEventArgs _
Inherits EventArgs
public class DataRepeaterDataErrorEventArgs : EventArgs
public ref class DataRepeaterDataErrorEventArgs : public EventArgs
type DataRepeaterDataErrorEventArgs =
class
inherit EventArgs
end
public class DataRepeaterDataErrorEventArgs extends EventArgs
DataRepeaterDataErrorEventArgs 类型公开以下成员。
构造函数
名称 | 说明 | |
---|---|---|
![]() |
DataRepeaterDataErrorEventArgs | 初始化 DataRepeaterDataErrorEventArgs 类的新实例。 |
页首
属性
名称 | 说明 | |
---|---|---|
![]() |
Control | 获取引发数据错误的 Control 。 |
![]() |
DataRepeaterItem | 获取引发数据错误的 DataRepeaterItem 。 |
![]() |
Exception | 获取表示该错误的 Exception 。 |
![]() |
PropertyName | 获取控件的属性的名称会引发该错误。 |
![]() |
ThrowException | 获取或设置一个在代码执行后引发异常退出 DataError 事件处理程序的值。 |
页首
方法
名称 | 说明 | |
---|---|---|
![]() |
Equals | 确定指定的对象是否等于当前对象。 (继承自 Object。) |
![]() |
Finalize | 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。) |
![]() |
GetHashCode | 用作特定类型的哈希函数。 (继承自 Object。) |
![]() |
GetType | 获取当前实例的 Type。 (继承自 Object。) |
![]() |
MemberwiseClone | 创建当前 Object 的浅表副本。 (继承自 Object。) |
![]() |
ToString | 返回表示当前对象的字符串。 (继承自 Object。) |
页首
备注
DataError 事件使您能够在数据操作过程中,代码引发由 DataRepeater 控件调用的异常。
示例
数据,则错误时,下面的示例演示如何使用从 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;
}
线程安全
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间