We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

null reference exception when adding a seccond appointment in SfSchedule

Thread ID:

Created:

Updated:

Platform:

Replies:

132107 Aug 14,2017 08:53 PM UTC Aug 18,2017 07:27 PM UTC WPF 1
loading
Tags: SfSchedule
Jesus
Asked On August 14, 2017 08:53 PM UTC

i want to add som reccurring appointments to an SfSchedule Control, it accept the dirst appointment that i put in it, but when i want to add a second one it gives me a null reference exception.

this is my code:

var appointment = ((Horarios.BindingClass) DataContext).Appointment as ScheduleAppointment ??
                              new ScheduleAppointment();

            RecurrenceProperties RecProp = new RecurrenceProperties
            {
                RecurrenceType = RecurrenceType.Weekly,
                IsRangeRecurrenceCount = false,
                IsRangeNoEndDate = true,
                IsRangeEndDate = false,

            };
           
           

            switch (((Horarios.BindingClass)DataContext).CurrentSelectedDate.Value.DayOfWeek)
            {
                case DayOfWeek.Sunday:
                    break;
                case DayOfWeek.Monday:
                    RecProp.IsWeeklyMonday = true;
                    break;
                case DayOfWeek.Tuesday:
                    RecProp.IsWeeklyTuesday = true;
                    break;
                case DayOfWeek.Wednesday:
                    RecProp.IsWeeklyWednesday = true;
                   
                    break;
                case DayOfWeek.Thursday:
                    RecProp.IsWeeklyThursday = true;
                    break;
                case DayOfWeek.Friday:
                    RecProp.IsWeeklyFriday = true;
                    break;
                case DayOfWeek.Saturday:

                    RecProp.IsWeeklySaturday = true;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            appointment.StartTime = StartTime.DateTime.Value;
            appointment.EndTime = EndTime.DateTime.Value;
            appointment.RecurrenceRule = ScheduleHelper.RRuleGenerator(RecProp,
            appointment.StartTime, appointment.EndTime);
            appointment.IsRecursive = false;
            EditorPage.Schedule.Appointments.Add(appointment);

i always get  a null reference exception on the last line when i'm addin a second appointment, does not matter if it is a recurrent appointment or not.

Sivakumar Punniya Moorthi [Syncfusion]
Replied On August 18, 2017 07:27 PM UTC

Hi Jesus, 

Thanks for using Syncfusion products. 

We had prepared a sample with the provided code snippet. Can you please provide as the following information?  So that we could provide you the prompt solution. 
1.      Version of SfSchedule.WPF.dll 
2.      .Net framework used. 
3.      Screen shot or stack trace of the Exception occurred. 

Sample Link :  ScheduleApp
 

Regards, 
Sivakumar P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;