Argh Listview

ZeroEffect

Junior Contributor
Joined
Oct 24, 2004
Messages
204
Location
Detroit, MI
So I thought my program was complete, I had it up and running when I left work and had a thought. Crap when this event ends it's not going to load events for tomorrow. So I have come up with the solution and it works... sort of. It works if the listview that it's getting it's information from isn't changed, viewed, or clicked. All that I'm doing is looping through a subitem and comparing a date. Here it the code.

Visual Basic:
Public Sub TodaysList(ByVal intAdvance As Integer)
        Dim TimeListDay As ListView.SelectedListViewItemCollection = TimedEventsForm.ListView1.SelectedItems
        Dim SelectedTime As ListViewItem
        Dim temp As Integer
        Dim strDay As String
        Dim blnDayNotFound As Boolean

        Do
            CurrentDayStr = Format(System.DateTime.FromOADate(Today.ToOADate + intAdvance), "dddd")
            temp = 1
            Do
                TimedEventsForm.ListView1.Items(temp - 1).Selected = True 'If the listview1 is changed
'or viewed by user the selected item doesn't 
'advance even though the value of "temp" does change.
                For Each SelectedTime In TimeListDay
                    strDay = SelectedTime.SubItems(2).Text
                    If strDay = CurrentDayStr Then
                        blnDayNotFound = True
                        NextTimedEvent()
                        Exit Sub
                    End If
                Next
                temp = temp + 1
            Loop Until temp > TimedEventsForm.ListView1.Items.Count
            If blnDayNotFound = False Then
                intAdvance = intAdvance + 1
            End If
        Loop Until intAdvance > 6 '6 covers all seven days
    End Sub

So the problem is that after any user intervention and sub is called that loops through the listview it only returns the value of the first item in the list.

any thoughts.

Thanks again

ZeroEffect
 
anyone :(

How about an alternative way. I was thinking of using a data base then loading the data base to the listview to show the events then scan the data base for the next days events.

anythoughts

ZeroEffect
 
Back
Top