title: Putting a new item in to the calendar overwrites the other item inside
body: <p>Hello can someone please tell me what could be the problem in my calendar. So let me explain whats happening. So first im trying to make a scheduler application and im using a WPF scheduler in VB, so to begin with, the tab of a calendar needs to display 3 items (Subject, Professor Name, Courses) so what i need to do is to choose a room first and then drag a subject name from the listbox (like this <a href="https://i.stack.imgur.com/FKnAJ.png" rel="nofollow noreferrer">Sample1</a>) and then next i need to drag a professors name (<a href="https://i.stack.imgur.com/xeQhZ.png" rel="nofollow noreferrer">Sample2</a>) and then heres where the problems starts</p>
  <p>So it already displays two items (Subject and Professor) now i need to drag an item from Course listbox, but the problem is whenever I put a course to the tab of a calendar, it becomes like this  <a href="https://i.stack.imgur.com/oZ28L.png" rel="nofollow noreferrer">instead</a></p>
  <p>So the goal here is to show 3 dragged items but instead, it only shows 2 and the course is overwriting the name of the subject. Please help me, thank you! If you want to see the whole codes, heres the link <a href="https://drive.google.com/file/d/1fWKisPr9qDh54B4EMdwWJbY3KFgi_xfc/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1fWKisPr9qDh54B4EMdwWJbY3KFgi_xfc/view?usp=sharing</a></p>
  <p>Heres the code of where you can drag the items</p>
  <pre><code> 'Dragging Data to Calendar
  Sub Add_list_item(ByVal list As String)
      Delay.Delay(1)
      Dim count = 0
      For Each item As CalendarItem In Calendar1.GetSelectedItems()
          count += 1
  
          If count &gt; 1 Then
              Return
          Else
              Dim get_item_end_time As DateTime = item.EndDate.AddHours(2)
              get_item_end_time = get_item_end_time.AddMinutes(30)
              Dim item_start_time = item.StartDate
              Dim item_end_time = get_item_end_time
              Dim item_tooltip = item.StartDate.ToString()
              Dim start_time = item.StartDate.ToString(&quot;HH:mm tt&quot;)
              Dim end_time = item.EndDate.ToString(&quot;HH:mm tt&quot;)
              Dim dat_start As Date = item_tooltip
              Dim ci As CultureInfo = CultureInfo.CreateSpecificCulture(&quot;en-US&quot;)
              Dim dtfi As DateTimeFormatInfo = ci.DateTimeFormat
              dtfi.AbbreviatedDayNames = {&quot;Sun&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;,
                                           &quot;5&quot;, &quot;6&quot;}
              Dim output_start As String = String.Format(ci, &quot;{0:ddd}&quot;, dat_start.AddDays(0))
  
              Dim item_text = CStr(item.Text)
              Dim parts As String() = item_text.Split(New String() {Environment.NewLine},
                                             StringSplitOptions.None)
  
              Dim get_item_total_hours = (item.EndDate - item.StartDate).TotalHours
              Dim get_start_time As DateTime
              Dim get_end_time As DateTime
  
              If get_item_total_hours = 1 Then
                  get_start_time = item.StartDate.AddMinutes(-30)
                  get_end_time = item.EndDate.AddMinutes(30)
              ElseIf get_item_total_hours = 1.5 Then
                  get_start_time = item.StartDate.AddHours(-1)
                  get_end_time = item.EndDate.AddHours(1)
              ElseIf get_item_total_hours = 2 Then
                  get_start_time = item.StartDate.AddHours(-1).AddMinutes(-30)
                  get_end_time = item.EndDate.AddHours(1).AddMinutes(30)
              ElseIf get_item_total_hours = 2.5 Then
                  get_start_time = item.StartDate.AddHours(-2)
                  get_end_time = item.EndDate.AddHours(2)
              ElseIf get_item_total_hours = 3 Then
                  get_start_time = item.StartDate.AddHours(-2).AddMinutes(-30)
                  get_end_time = item.EndDate.AddHours(2).AddMinutes(30)
              ElseIf get_item_total_hours = 3.5 Then
                  get_start_time = item.StartDate.AddHours(-3)
                  get_end_time = item.EndDate.AddHours(3)
              ElseIf get_item_total_hours = 4 Then
                  get_start_time = item.StartDate.AddHours(-3).AddMinutes(-30)
                  get_end_time = item.EndDate.AddHours(3).AddMinutes(30)
              ElseIf get_item_total_hours = 4.5 Then
                  get_start_time = item.StartDate.AddHours(-4)
                  get_end_time = item.EndDate.AddHours(4)
              ElseIf get_item_total_hours = 5 Then
                  get_start_time = item.StartDate.AddHours(-4).AddMinutes(-30)
                  get_end_time = item.EndDate.AddHours(4).AddMinutes(30)
              ElseIf get_item_total_hours = 5.5 Then
                  get_start_time = item.StartDate.AddHours(-5)
                  get_end_time = item.EndDate.AddHours(5)
              ElseIf get_item_total_hours = 6 Then
                  get_start_time = item.StartDate.AddHours(-5).AddMinutes(-30)
                  get_end_time = item.EndDate.AddHours(5).AddMinutes(30)
              End If
  
              If (ListBox1_Instructor.Items.Contains(list) = True) Then
                  Call Check_if_instructor(list)
              End If
  
              If parts.Count &gt;= 3 Then
                  If (instructor_name = True) Then
  
                      Call Get_instructor_code(instructor_gender + list)
                      Call Get_course_name(corSec_id)
                      Call checkInstructorSchedule(start_time, end_time, output_start, instructor_id)
  
                      If (instructor_name = True) Then
                          If instructor_gender = &quot;Male&quot; Then
                              instructor_gender = &quot;Mr. &quot;
                          Else
                              instructor_gender = &quot;Ms. &quot;
                          End If
  
                          If item.Text &lt;&gt; &quot;&quot; Then
                              item.Text = parts(0) + vbNewLine + vbNewLine + instructor_gender + list
                              item.ApplyColor(Color.RoyalBlue)
                          End If
                          instructor_name = False
                      End If
  
                  Else
                      item.ApplyColor(Color.RoyalBlue)
                      item.Text = list + vbNewLine + vbNewLine + parts(2) + vbNewLine + vbNewLine
                  End If
              ElseIf parts.Count = 1 Then
                  If (instructor_name = True) Then
  
                      Call Get_instructor_code(instructor_gender + list)
                      Call Get_course_name(corSec_id)
                      Call checkInstructorSchedule(start_time, end_time, output_start, instructor_id)
  
                      If (instructor_name = True) Then
                          If instructor_gender = &quot;Male&quot; Then
                              instructor_gender = &quot;Mr. &quot;
                          Else
                              instructor_gender = &quot;Ms. &quot;
                          End If
  
                          If item.Text &lt;&gt; &quot;&quot; Then
                              item.Text = parts(0) + vbNewLine + vbNewLine + instructor_gender + list
                              item.ApplyColor(Color.RoyalBlue)
                          End If
  
                          instructor_name = False
                      End If
                  Else
                      item.ApplyColor(Color.RoyalBlue)
                      item.Text = list + vbNewLine + vbNewLine + parts(parts.Count - 1) + vbNewLine + vbNewLine
                  End If
              End If
              Calendar1.Invalidate(item)
          End If
      Next
  End Sub
  </code></pre>