I've recently inserted a MonthView object into my project with the intention of loading specific data items in a ListView when a certain date is clicked which is associated with the data item.
So basically the user clicks on a date in the MonthView and items are displayed in a ListView.
This works as planned but for some reason it only works the first time the project is loaded. I click a date and the information is displayed, then I click another date which clears the ListView as intended but when I click back on the first date no more information is displayed in the ListView. This isn't remedied by unloading and loading the form either; the project must be stopped and restarted for the same thing to occur again.
Here's my coding for the MonthView, excuse any sloppiness or validation, I'm merely looking for a solution to my problem.
So basically the user clicks on a date in the MonthView and items are displayed in a ListView.
This works as planned but for some reason it only works the first time the project is loaded. I click a date and the information is displayed, then I click another date which clears the ListView as intended but when I click back on the first date no more information is displayed in the ListView. This isn't remedied by unloading and loading the form either; the project must be stopped and restarted for the same thing to occur again.
Here's my coding for the MonthView, excuse any sloppiness or validation, I'm merely looking for a solution to my problem.
Code:
Private Sub Calendar_DateClick(ByVal DateClicked As Date)
Dim Order_Channel As Integer
Dim O As Order
Dim Game_Channel As Integer
Dim G As Game
Dim X As Integer
Dim Y As Integer
Dim Z As Integer
Date_List.ListItems.Clear
Date_Label.Caption = ""
If Calendar.Day <= 9 Then
Date_Label.Caption = "0" + Trim(Trim(Calendar.Day) + "/" + Trim(Calendar.Month) + "/" + Trim(Calendar.Year))
Else
Date_Label.Caption = Trim(Trim(Calendar.Day) + "/" + Trim(Calendar.Month) + "/" + Trim(Calendar.Year))
End If
Z = 1
X = 1
Order_Channel = FreeFile
Open Order_File For Random As Order_Channel Len = Order_Length
Get Order_Channel, X, O
Game_Channel = FreeFile
Do While Not EOF(Order_Channel)
If Trim(O.Order_Date) = Trim(Date_Label.Caption) Then
Open Game_File For Random As Game_Channel Len = Game_Length
Y = 1
Get Game_Channel, Y, G
Do While Not EOF(Game_Channel) And Found = False
If Trim(O.Game_ID) = Trim(G.Game_ID) Then
Date_List.ListItems.Add , , Trim(G.Game_Title)
Date_List.ListItems(Z).SubItems(1) = Trim(G.Game_Console)
Date_List.ListItems(Z).SubItems(2) = Trim(G.Game_Sold)
Date_List.ListItems(Z).SubItems(3) = Trim(G.Game_ID)
Z = Z + 1
Found = True
End If
Y = Y + 1
Get Game_Channel, Y, G
Loop
Close Game_Channel
End If
X = X + 1
Get Order_Channel, X, O
Loop
Close Order_Channel
End Sub