Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Cannot remove the nonrecurring item (Read 7509 times)
byucel
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jul 13th, 2008
Cannot remove the nonrecurring item
Jul 13th, 2008 at 4:47pm
Print Post  
Hi everyone,
I am testing Planner.net trial version. When we are trying to remove an item then we are getting an exception.

"cannot remove the specified item because it was not found in the specified collection"

Here is the code
Any help will be appreciated

    Private Sub mfsSchedule_ItemClick(ByVal sender As Object, ByVal e As MindFusion.Scheduling.WinForms.ItemMouseEventArgs) Handles mfsSchedule.ItemClick
       Try
           If e.Clicks = 1 And e.Button = Windows.Forms.MouseButtons.Right Then
               Dim myAppForm As frmAppointment = New frmAppointment()
               myAppForm.ItemHeader = e.Item.HeaderText
               myAppForm.ItemSubject = e.Item.HeaderText
               myAppForm.ItemStartDate = e.Item.StartTime
               myAppForm.ItemStartTime = e.Item.StartTime
               myAppForm.ItemEndDate = e.Item.EndTime
               myAppForm.ItemEndTime = e.Item.EndTime
               Dim _result As DialogResult = myAppForm.ShowDialog(Me)
               If _result = System.Windows.Forms.DialogResult.OK Then
                   mfsSchedule.BeginInit()
                   mfsSchedule.Schedule.Items(e.Item.Id).HeaderText = myAppForm.ItemHeader
                   Dim _startdate As DateTime = New DateTime(myAppForm.ItemStartDate.Year, myAppForm.ItemStartDate.Month, myAppForm.ItemStartDate.Day) + myAppForm.ItemStartTime.TimeOfDay
                   Dim _enddate As DateTime = New DateTime(myAppForm.ItemEndDate.Year, myAppForm.ItemEndDate.Month, myAppForm.ItemEndDate.Day) + myAppForm.ItemEndTime.TimeOfDay
                   mfsSchedule.Schedule.Items(e.Item.Id).StartTime = _startdate
                   mfsSchedule.Schedule.Items(e.Item.Id).EndTime = _enddate
                   mfsSchedule.EndInit()
               ElseIf _result = System.Windows.Forms.DialogResult.Abort Then
                   Dim rec As New MindFusion.Scheduling.Recurrence()
                   If e.Item.RecurrenceState = MindFusion.Scheduling.RecurrenceState.Occurrence Or _
                           e.Item.RecurrenceState = MindFusion.Scheduling.RecurrenceState.Exception Then
                       e.Item.Recurrence.MarkException(e.Item, True)
                   Else
                       mfsCalendar.Schedule.Items.Remove(e.Item)
                   End If
               End If
           End If
       Catch ex As Exception
           sMsgStr = "Açıklama : Hata" & vbCrLf & vbCrLf
           sMsgStr = sMsgStr & "--- Ayrıntılar ----------------------------" & vbCrLf
           sMsgStr = sMsgStr & "Lokasyon : " & "frmMenu" & vbCrLf
           sMsgStr = sMsgStr & "Fonksiyon: mfsSchedule_ItemClick" & vbCrLf
           sMsgStr = sMsgStr & "Mesaj       : " & ex.Message.ToString()
           vResult = MessageBox.Show(sMsgStr, "İşlem Hatası", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
       End Try
    End Sub
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Cannot remove the nonrecurring item
Reply #1 - Jul 14th, 2008 at 6:49am
Print Post  
I noticed that you are handling the click event on an item in one Calendar instance (mfsSchedule) and then trying to remove the clicked item from another instance (mfsCalendar). Is this intended? If it is, then you have to make sure that both schedules are synchronized, that is, if an item exists in one of the schedules, it should be present in the other as well.

Meppy
  
Back to top
 
IP Logged
 
byucel
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Jul 13th, 2008
Re: Cannot remove the nonrecurring item
Reply #2 - Jul 14th, 2008 at 7:58am
Print Post  
Hi,

You are right, it is a fault. I just copy that line from a samplei and change with wrong instance.  Embarrassed

Nowadays I am working too hard, it is a just programmer blindness. Sorry for your time vasting.

Thank a lot for your help
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint