DataRepeaterDataErrorEventArgs Constructor
Initializes a new instance of the DataRepeaterDataErrorEventArgs class.
Namespace: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
'Declaração
Public Sub New ( _
item As DataRepeaterItem, _
control As Control, _
prop As String, _
ex As Exception _
)
public DataRepeaterDataErrorEventArgs(
DataRepeaterItem item,
Control control,
string prop,
Exception ex
)
public:
DataRepeaterDataErrorEventArgs(
DataRepeaterItem^ item,
Control^ control,
String^ prop,
Exception^ ex
)
new :
item:DataRepeaterItem *
control:Control *
prop:string *
ex:Exception -> DataRepeaterDataErrorEventArgs
public function DataRepeaterDataErrorEventArgs(
item : DataRepeaterItem,
control : Control,
prop : String,
ex : Exception
)
Parameters
- item
Type: Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
The DataRepeaterItem on which the error occurred.
- control
Type: System.Windows.Forms.Control
- prop
Type: System.String
The property on which the error occurred. For most controls, this will be the Text property.
- ex
Type: System.Exception
The exception object.
Remarks
The DataError event enables you to handle exceptions that are thrown in code that is called by a DataRepeater control during data processing operations.
Examples
The following example demonstrates how to use the data from a DataRepeaterDataErrorEventArgs to display a message when a data error occurs.
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 Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
DataRepeaterDataErrorEventArgs Class
Microsoft.VisualBasic.PowerPacks Namespace