|
-
Jun 18th, 2003, 09:09 AM
#1
Thread Starter
Member
Highlighting row in a listview
The following is my code for highlighting a specific row on a listview based on two variables being equal. Problem is that the correct row gets highlighted only after I scroll up or down. Tried the Refresh method on the listview to no avail. And I've changed the order of the lines between the if..end if with no success. Please help. Thx.
Private Sub selectRow(Index As Integer, cObj As CollectionClassObject)
Dim l_DetailID As Long
Dim i As Integer
For i = 1 To lvDetails(Index).ListItems.Count
l_DetailID = cObj.Item(lvDetails(Index).ListItems(i).Key).DetailID
If m_DetailID = l_DetailID Then
lvDetails(Index).ListItems(i).Selected = True
lvDetails(Index).SetFocus
Exit For
End If
Next i
End Sub
-
Jun 18th, 2003, 09:47 AM
#2
Member
Hi,
I think what u have done is right. The only thing u need to do is to insert the following code before u set the seleted item.
lvDetails.HideSelection = False
or
u can uncheck this property in the property page of the list view.
Bye & regards,
Ravi.
-
Jun 18th, 2003, 10:38 AM
#3
Junior Member
VB Code:
If (m_DetailID = l_DetailID) Then Set lvDetails.SelectedItem = lvDetails(Index).Listitems(i)
-
Jun 18th, 2003, 11:12 AM
#4
Thread Starter
Member
thx!! Setting HideSelection to false worked.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|