Back to Devexpress

How to: Set Default Values for a New Appointment

windowsforms-2277-controls-and-libraries-scheduler-examples-initialization-how-to-set-default-values-for-a-new-appointment.md

latest1.4 KB
Original Source

How to: Set Default Values for a New Appointment

  • Nov 13, 2018

This example demonstrates how to use the SchedulerControl.InitNewAppointment event, which occurs in all cases before a new appointment is created. This event can be used to initialize a newly created appointment with values other than the default.

View Example

csharp
private void schedulerControl1_InitNewAppointment(object sender, DevExpress.XtraScheduler.AppointmentEventArgs e)
{
    e.Appointment.Description += "Created at runtime at " + String.Format("{0:g}", DateTime.Now);
    e.Appointment.CustomFields["Amount"] = 00.01d;
    e.Appointment.CustomFields["ContactInfo"] = "[email protected]";
}
vb
Private Sub schedulerControl1_InitNewAppointment(ByVal sender As Object, ByVal e As DevExpress.XtraScheduler.AppointmentEventArgs) Handles schedulerControl1.InitNewAppointment
    e.Appointment.Description &= "Created at runtime at " & String.Format("{0:g}", Date.Now)
    e.Appointment.CustomFields("Amount") = 00.01R
    e.Appointment.CustomFields("ContactInfo") = "[email protected]"
End Sub