Appointments AddRange problem

Originally Posted 7 June 2017, 11:22 am EST

  • Originally Posted 7 June 2017, 11:22 am EST

    Hi
    When used the Appointments.AddRange the error message below shows:

    Object reference not set to an instance of an object.

    Sample Code:
    C1.C1Schedule.Appointment[] app = new C1.C1Schedule.Appointment[10];
    app[0].AllDayEvent = true;
    app[0].Subject = "Subject1";
    app[0].Start = Convert.ToDateTime("2017/06/07");

    app[1].AllDayEvent = true;
    app[1].Subject = "Subject2";
    app[1].Start = Convert.ToDateTime("2017/06/07");
    c1Schedule1.DataStorage.AppointmentStorage.Appointments.AddRange(app);
    please guide me.
  • Reply

    as I see, you created array of appointments, but didn't create any appointments in it. So when you try to get app[0] is is null. you should create appointment first, something like

    app[0] = new Appointment();
  • Reply

    Hi
    Thanks for the answer.

    How can the day-area 4 appointment to completely shows?

  • Reply

    Hi,

    Thanks for providing the screenshot.

    In order to further investigate on this issue we request you to please share a stripped down sample application representing it.

    Thanks,
    Akshay
  • Reply

    Hi
    sample application
    please check it.
    2017/06/c1Schedule.zip
  • Marked as Answer

    Reply

    Hi,

    Thanks for providing the sample application.

    In order to show four appointments in a day area in month view you need to set AppointmentHeight property of C1Schedule accordingly.
    c1Schedule1.AppointmentHeight = 23;


    Thanks,
    Akshay
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels