Version

AppointmentDataError Event

Fired when specific value in data source is invalid.
Syntax
'Declaration
 
Public Event AppointmentDataError As AppointmentDataErrorEventHandler
public event AppointmentDataErrorEventHandler AppointmentDataError
Event Data

The event handler receives an argument of type AppointmentDataErrorEventArgs containing data related to this event. The following AppointmentDataErrorEventArgs properties provide information specific to this event.

PropertyDescription
Appointment Returns a reference to the Appointment whose corresponding data row contains invalid data.
BoundValue (Inherited from Infragistics.Win.UltraWinSchedule.DataErrorEventArgsBase)Returns the converted value retrieved from the bound field.
MemberName (Inherited from Infragistics.Win.UltraWinSchedule.DataErrorEventArgsBase)Returns the name of the bound field whose value caused the error to occur.
Message (Inherited from Infragistics.Win.UltraWinSchedule.DataErrorEventArgsBase)Gets/sets the message that will be displayed to the end user.
PropertyId Returns the property identifier that describes the Appointment property whose data binding returned an invalid value.
ShowMessageBox (Inherited from Infragistics.Win.UltraWinSchedule.DataErrorEventArgsBase)Determines whether a MessageBox is displayed when a data binding error occurs.
Example
Private Sub ultraCalendarInfo1_AppointmentDataError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.AppointmentDataErrorEventArgs) Handles ultraCalendarInfo1.AppointmentDataError
        'Cancel the default message box
        e.ShowMessageBox = False

        'Show a custom message box
        Dim result As DialogResult = MessageBox.Show(Me, "Failed to add appointment. Would you like to set default values?", "Error", MessageBoxButtons.YesNo)
        If (result = DialogResult.Yes) Then
            'Check it the Subject was Nothing
            Dim dr As DataRow = DirectCast(e.Appointment.BindingListObject, DataRowView).Row
            If (dr("Subject") Is DBNull.Value) Then
                'Set the subject to a default string
                e.Appointment.Subject = "Error appointment"
            End If

            'Check if the StartDateTime is Nothing
            If (dr("StartDateTime") Is DBNull.Value) Then
                'Set StartDateTime to a deafult
                e.Appointment.StartDateTime = DateTime.Now
            End If

            'Check if the EndDateTime is Nothing and make sure it is after the StartDateTime
            If (dr("EndDateTime") Is DBNull.Value OrElse DirectCast(dr("EndDateTime"), DateTime) <= DirectCast(dr("StartDateTime"), DateTime)) Then
                'Set EndDateTime to a deafult
                e.Appointment.EndDateTime = e.Appointment.StartDateTime.AddHours(1)
            End If
        End If
    End Sub
private void ultraCalendarInfo1_AppointmentDataError(object sender, Infragistics.Win.UltraWinSchedule.AppointmentDataErrorEventArgs e)
{

	//Cancel the default message box
	e.ShowMessageBox = false;

	//Show a custom message box
	DialogResult result = MessageBox.Show(this, "Failed to add appointment. Would you like to set default values?", "Error", MessageBoxButtons.YesNo);
	if ( result == DialogResult.Yes )
	{
		//Check it the Subject was null
		DataRow dr = ((DataRowView)e.Appointment.BindingListObject).Row;
		if ( dr["Subject"] == DBNull.Value )
		{
			//Set the subject to a default string
			e.Appointment.Subject = "Error appointment";
		}
		
		//Check if the StartDateTime is null
		if ( dr["StartDateTime"] == DBNull.Value )
		{
			//Set StartDateTime to a deafult
			e.Appointment.StartDateTime = DateTime.Now;
		}

		//Check if the EndDateTime is null and make sure it is after the StartDateTime
		if ( dr["EndDateTime"] == DBNull.Value 
			|| ((DateTime)dr["EndDateTime"]) <= ((DateTime)dr["StartDateTime"]))
		{
			//Set EndDateTime to a deafult
			e.Appointment.EndDateTime = e.Appointment.StartDateTime.AddHours(1);
		}
	}			
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also