Share via


DataRepeaterDataErrorEventArgs-Konstruktor

Initialisiert eine neue Instanz der DataRepeaterDataErrorEventArgs-Klasse.

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

Syntax

'Declaration
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
)

Parameter

  • prop
    Typ: System.String
    Die Eigenschaft, auf der der Fehler aufgetreten ist.Für die meisten Steuerelemente ist dies die Text-Eigenschaft.

Hinweise

Das DataError-Ereignis ermöglicht Ihnen, um Ausnahmen zu behandeln, die in Code ausgelöst werden, der durch ein DataRepeater-Steuerelement während der datenverarbeitenden Vorgänge aufgerufen wird.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie die Daten aus DataRepeaterDataErrorEventArgs verwendet, um eine Meldung anzeigen, wenn ein Datenfehler auftreten.

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-Sicherheit

Siehe auch

Referenz

DataRepeaterDataErrorEventArgs Klasse

Microsoft.VisualBasic.PowerPacks-Namespace

DataError

Weitere Ressourcen

Einführung in das DataRepeater-Steuerelement (Visual Studio)