Share via


DataRepeaterDataErrorEventArgs Class

 

Provides data for the DataError event.

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

Inheritance Hierarchy

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

Syntax

public class DataRepeaterDataErrorEventArgs : EventArgs
public ref class DataRepeaterDataErrorEventArgs : EventArgs
type DataRepeaterDataErrorEventArgs = 
    class
        inherit EventArgs
    end
Public Class DataRepeaterDataErrorEventArgs
    Inherits EventArgs

Constructors

Name Description
System_CAPS_pubmethod DataRepeaterDataErrorEventArgs(DataRepeaterItem, Control, String, Exception)

Initializes a new instance of the DataRepeaterDataErrorEventArgs class.

Properties

Name Description
System_CAPS_pubproperty Control

Gets the Control that raised the data error.

System_CAPS_pubproperty DataRepeaterItem

Gets the DataRepeaterItem that raised the data error.

System_CAPS_pubproperty Exception

Gets the Exception that represents the error.

System_CAPS_pubproperty PropertyName

Gets the name of the property of the control that raised the error.

System_CAPS_pubproperty ThrowException

Gets or sets a value that indicates whether to throw an exception after code execution exits the DataError event handler.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from 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 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;
}
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

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

DataError
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)

Return to top