DataRepeaterDataErrorEventArgs Class

Provides data for the DataError event.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.VisualBasic.PowerPacks.DataRepeaterDataErrorEventArgs

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaração
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

The DataRepeaterDataErrorEventArgs type exposes the following members.

Constructors

  Name Description
Public method DataRepeaterDataErrorEventArgs Initializes a new instance of the DataRepeaterDataErrorEventArgs class.

Top

Properties

  Name Description
Public property Control Gets the Control that raised the data error.
Public property DataRepeaterItem Gets the DataRepeaterItem that raised the data error.
Public property Exception Gets the Exception that represents the error.
Public property PropertyName Gets the name of the property of the control that raised the error.
Public property ThrowException Gets or sets a value that indicates whether to throw an exception after code execution exits the DataError event handler.

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

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;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualBasic.PowerPacks Namespace

DataError

Other Resources

Introduction to the DataRepeater Control (Visual Studio)