Skip to main content
A newer version of this page is available.
All docs
V18.2

How to: Create a Custom Appointment Recurrence Form (Method 2)

  • 9 minutes to read

This document describes how to create a custom form and replace the standard appointment recurrence editing form with a newly created form. Method 2 uses the System.Windows.Forms.Form and the AppointmentFormController.

To create a custom form, add a new form to the project and name it MyAppointmentRecurrentForm.

There are six recurrence types (refer to the RecurrenceType topic) and four ready-to-use recurrent controls suitable for most situations. To add required controls to the form, perform the following steps:

  1. Select the GroupControl in the Toolbox and drop it onto the MyAppointmentRecurrentForm. Change its visibility to false.
  2. Drag the DailyRecurrenceControl from the Toolbox and drop it on the GroupControl. Place it over the previous control. Change its visibility to false.
  3. Drag the WeeklyRecurrenceControl from the Toolbox and drop it on the GroupControl. Place it over the previous control. Change its visibility to false.
  4. Drag the MonthlyRecurrenceControl from the Toolbox and drop it on the GroupControl. Place it over the previous control. Change its visibility to false.
  5. Drag the YearlyRecurrenceControl from the Toolbox and drop it on the GroupControl. Place it over the previous control. Change its visibility to false.
  6. Select the RadioGroup control in the Toolbox and drop it on the form. Add four items to the control with the RadioGroupItem.Description values set to Daily, Weekly, Monthly and Yearly. Specify these strings as the RadioGroupItem.Value property values.
  7. Add OK and Cancel buttons.

The form will look like that shown in the following picture.

CustomRecurrenceFormMethod2

Add the code to the code behind file as illustrated in the following example.

The code below is an example of the custom recurrent appointment editing form. Invoke it for recurring appointments. This form allows changing recurrence options only. To change start/end times and durations, add other controls to the form.

Handle the SchedulerControl.EditAppointmentFormShowing event to invoke a custom form instead of the default AppointmentForm.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CustomRecurrenceFormWinFormSample
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

Some comments are given below to clarify the interaction logic.