Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21266

[RESOLVED] how to filter hairdressers by name Via Calendar control

$
0
0
i bought a calander control that make appointments
now i added a combobox to filter the customer's by hairdressers names
the problem is it dosnt filter very good
e.x
if salsa has 8 appointments and david has 10 so the calander shows 18 appointments right?

if i choose from the combobox david then i see his appointments but also some of salsa
the samething if i choose salsa
i found a form for the calander but something is missing there or in my code
this is the 2 codes they suggested
Code:

Private Sub CalendarControl_PrePopulate(ByVal ViewGroup As XtremeCalendarControl.CalendarViewGroup, ByVal Events As XtremeCalendarControl.CalendarEvents)
    If Events.Count > 0 Then
        Dim i As Long
        For i = Events.Count - 1 To 0 Step -1
            If Not Events(i).CustomProperties("name") = "" Then
                If Not Events(i).CustomProperties("name") = strName Then
                    Events.Remove i
                End If
            End If
        Next
    End If
End Sub

Code:

Private Sub CalendarControl_PrePopulate(ByVal ViewGroup As XtremeCalendarControl.CalendarViewGroup, ByVal Events As XtremeCalendarControl.CalendarEvents)
 Dim pEvent As CalendarEvent
 Dim x As Integer
 x = 0
 
 For Each pEvent In Events
  If bFilterMode Then
  If pEvent.Subject <> sFilterText Then
    Events.Remove x
  End If
  x = x + 1
  End If
 Next
End Sub

now this is the code i tried
Code:

Private Sub CmbHair_Click()
    CalendarControl.Populate
    CalendarControl.RedrawControl
End Sub

Code:

Private Sub CalendarControl_PrePopulate(ByVal ViewGroup As XtremeCalendarControl.CalendarViewGroup, ByVal Events As XtremeCalendarControl.CalendarEvents)
'      If CmbHair.ListIndex = 0 Then Exit Sub 'No filter Coulam
   
  Dim pEvent As CalendarEvent
    Dim strData As String

    Dim x As Integer
    x = 0

    For Each pEvent In Events
        'If not Coulam and not
        If (pEvent.Body <> CmbHair).text Then
            Events.Remove x
        Else
            Debug.Print "Not filter Body= " & pEvent.Body
        End If
        x = x + 1
    Next

   
    For Each pEvent In Events

        pEvent.CustomIcons.RemoveAll
        If mnuCustomIcons.Checked Then

            ' customize standard icons
            If pEvent.PrivateFlag Then
                pEvent.CustomIcons.Add xtpCalendarEventIconIDPrivate
            End If

            If pEvent.Reminder Then
                pEvent.CustomIcons.Add xtpCalendarEventIconIDReminder
            End If

            If pEvent.RecurrenceState = xtpCalendarRecurrenceOccurrence Then
                pEvent.CustomIcons.Add xtpCalendarEventIconIDOccurrence
            End If

            If pEvent.RecurrenceState = xtpCalendarRecurrenceException Then
                pEvent.CustomIcons.Add xtpCalendarEventIconIDException
            End If
        End If
    Next

    If mnuCustomIcons.Checked Then
        If Events.Count = 1 Then
            Events(0).CustomIcons.Add 1
            Events(0).CustomIcons.Add 4
            Events(0).CustomIcons.Add 5

        ElseIf Events.Count >= 3 Then
            Events(0).CustomIcons.Add 3

            Events(1).CustomIcons.Add 2
            Events(1).CustomIcons.Add 6

            Events(2).CustomIcons.Add 6
            Events(2).CustomIcons.Add 6

        ElseIf Events.Count >= 2 Then
            Events(0).CustomIcons.Add 2
            Events(0).CustomIcons.Add 5

            Events(1).CustomIcons.Add 4
            Events(1).CustomIcons.Add 6
        End If
    End If

if any information is needed i will add
regards salsa31

Viewing all articles
Browse latest Browse all 21266

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>