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
235
Appointments IN A LISTVIEW
posted

Is there a possibility to visualize the appointments in a listview like outlook does?

Parents
No Data
Reply
  • 2094
    Offline posted

     Very Easy to do yourself as Brian Suggested:

     

        Private Sub PopulateSchedulingListView()

            '   Set the column widths
            Dim defaultWidth As Int32 = (Me.UltraListView1.Width - 260) / (Me.UltraListView1.SubItemColumns.Count)

            '    Iterate the Appointments collection, and add an item for each Appointment
            Dim appointment As Appointment

            '   Clear the Items collection
            Me.UltraListView1.Items.Clear()

            Me.UltraListView1.MainColumn.Width = 250
            '   Set the column widths
            Dim header2 As Infragistics.Win.UltraWinListView.UltraListViewSubItemColumn
            For Each header2 In Me.UltraListView1.SubItemColumns
                header2.Width = defaultWidth
            Next

            '    Iterate the Appointments collection, and add an item for each Appointment
            For Each appointment In Me.calendarInfo.Appointments

                If appointment.Owner.Key = Me.appointmentowner.Key Then
                    '   Subject
                    Dim lvItem2 As UltraWinListView.UltraListViewItem = Me.UltraListView1.Items.Add(appointment.BindingListIndex)
                    lvItem2.Value = appointment.Subject

                    '   Location
                    If Not appointment.Location Is Nothing AndAlso appointment.Location.Length > 0 Then
                        lvItem2.SubItems("Request").Value = (appointment.Location)
                    Else
                        lvItem2.SubItems("Request").Value = "None"
                    End If

                    '   Label
                    Try
                        Dim info As ExtendedAppointmentInfo = DirectCast(appointment.Tag, ExtendedAppointmentInfo)
                        If Not info Is Nothing AndAlso Not info.Label Is Nothing Then
                            lvItem2.SubItems("Label").Value = info.Label.DisplayText
                        Else
                            lvItem2.SubItems("Label").Value = "None"
                        End If
                    Catch
                    End Try

                    '    StartDateTime
                    lvItem2.SubItems("Start Date").Value = appointment.StartDateTime.Date
                    Me.UltraListView1.SubItemColumns("Start Date").DataType = GetType(DateTime)
                    lvItem2.SubItems("Start Time").Value = appointment.StartDateTime.ToShortTimeString

                    '    EndDateTime
                    lvItem2.SubItems("End Date").Value = appointment.EndDateTime.Date
                    Me.UltraListView1.SubItemColumns("End Date").DataType = GetType(DateTime)
                    lvItem2.SubItems("End Time").Value = appointment.EndDateTime.ToShortTimeString()

                    '   AllDayEvent
                    If appointment.AllDayEvent Then
                        lvItem2.SubItems("All Day Event").Value = "Yes"
                    Else
                        lvItem2.SubItems("All Day Event").Value = "No"
                    End If

                    '   Set the ForeColor to Red if the Appointment is past due
                    If appointment.StartDateTime < DateTime.Now Then
                        lvItem2.Appearance.ForeColor = Color.Red
                    End If
                Else
                    ' Not the same owner
                End If
            Next

            Me.UltraListView1.ViewSettingsDetails.FullRowSelect = True

     End Sub

     

    Hope this helps - BTW it is pretty much a copy and paste from the Outlook2003/2007 Custom Dialog examples

    Cheers
    Aaron 

Children
No Data