Spawny
Aug 31st, 1999, 03:56 PM
Hi, I have a listview and a listbox on the a form. The listview lists the clients that are in a certain list. The listbox lists clients that have been diaryed for a certain date by a calendar control. So if 01/09/99 is selected in the calendar control then in the listbox clients are listed for that date. Now at present all the commands work with the listview when a listview item is selected. What happens next is that the selected item in the list box is also selected in the listview automatically. Now I have this code for that to work. The listbox is called LsvView and the listview is called LsvDetails.
Private Sub LstView_Click()
For i = 1 To LsvDetails.ListItems.Count
If LstView.Text = LsvDetails.ListItems(i).SubItems(1) & " " & LsvDetails.ListItems(i).Text Then
LsvDetails.ListItems(i).Selected = True
For j = 1 To LsvDetails.ListItems.Count
If LsvDetails.ListItems.Item(j).Index = i Then
fp.KeyValue = Mid$(LsvDetails.ListItems(j).Key, 2)
fp.Refresh = False
End If
Next
LsvDetails.SetFocus
Exit For
End If
Next i
End Sub
Now this works. It highlights the listbox item and at the same time highlights the related item in the listview. The PROBLEM I have is that i need the newly selected item in the listview to become the keyvalue selected. fp. menas form parameters. If anyone knows how to do this could they please tell me. Thanx in advance for any help. It would be highly appreciated.
Mike
Private Sub LstView_Click()
For i = 1 To LsvDetails.ListItems.Count
If LstView.Text = LsvDetails.ListItems(i).SubItems(1) & " " & LsvDetails.ListItems(i).Text Then
LsvDetails.ListItems(i).Selected = True
For j = 1 To LsvDetails.ListItems.Count
If LsvDetails.ListItems.Item(j).Index = i Then
fp.KeyValue = Mid$(LsvDetails.ListItems(j).Key, 2)
fp.Refresh = False
End If
Next
LsvDetails.SetFocus
Exit For
End If
Next i
End Sub
Now this works. It highlights the listbox item and at the same time highlights the related item in the listview. The PROBLEM I have is that i need the newly selected item in the listview to become the keyvalue selected. fp. menas form parameters. If anyone knows how to do this could they please tell me. Thanx in advance for any help. It would be highly appreciated.
Mike