Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Getting an Error: Cannot access a disposed object. Object name: 'Infragistics.Win.UltraWinSchedule.Owner
posted

Hello,

I am programming a scheduling application and I am running into a problem when first changing dates to pull appointments on an ultramonthmulti control and a UltracheckEditor. What I am doing is selecting a date from my calendar control and it will get appointments seven days before the selected date and 7 days after. It will then match the schedules to the owners. that part works fine. However, when I uncheck an owner so their column on the dayview won't show, I get the error "Cannoe access a disposed object."

Here is the code I'm using where the error occurs:

 

      #region Owner Checkbox Actions

        private void OwnerCheckbox_CheckedChanged(object sender, EventArgs e)

        {

            UltraCheckEditor checkEditor = sender as UltraCheckEditor;

            Owner owner = checkEditor.Tag as Owner; //<-- this is causing the Owner to be Disposed!!!

 

            MessageBox.Show(owner.Disposed.ToString());

            owner.Visible = checkEditor.Checked;

        }

I am basing this code on the sample SCHEDULE CS Demo that is provided. Now, if I do not change the date on the calendar control (as I load the schedule data as well as the owners at the Form_Load event), I can successfully check and uncheck owners. It properly hides and unhides the owner's schedule column in the dayview and the owner's row in the timelineview. The "dispose" error only occurs after I change to another date on the multi calendar (which is connected to a calendarInfo). The code to fetch schedules and plot them based on the date selected is performed in a MouseUp event. All I am doing in this even is binding data based on the selected date.

Any ideas why this is happening?