ListView Controls Highlighted Item 
Author Message
 ListView Controls Highlighted Item

To All on MSDN Discussion Forum:

In my application I have a ListView control that gets
populated from a previous MouseDown event.  When I select
an item in the ListView control other than the first item
in the list, the first item gets highlighted and then the
actual item that was selected gets highlighted.  I want
the selected item to be immediately highlighted without
the application first highlighting the first item in the
ListView control.  Note that if the items are sorted, then
the first item from the query used to populate the
ListView control gets highlighted before the selected item
gets highlighted.  Also I never tell the application to
highlight the first item, this is somehow occurring
automatically.

Has anyone come across this problem before?  Is there
anyway to prevent the application from automatically
highlighting the first item in the ListView control when
any item is selected?  Any help or hints on this topic
would be greatly appreciated.  Thanks in advance.



Fri, 11 Mar 2005 22:37:18 GMT  
 ListView Controls Highlighted Item
After populating (before allowing the user to click), run this code.. it
should clear any "selected" items.
'=======
   With ListView1
      If Not .SelectedItem Is Nothing Then
         .SelectedItem.Selected = False
         Set .SelectedItem = Nothing
      End If
   End With
'=======

--
Ken Halter - MS-MVP2-VB - Please keep it in the groups..
http://www.vbsight.com - http://www.vbsight.com/MultiColumn.htm
New Tabbed Dialog http://www.vbsight.com/TBGDialogCTL.htm


Quote:
> To All on MSDN Discussion Forum:

> In my application I have a ListView control that gets
> populated from a previous MouseDown event.  When I select
> an item in the ListView control other than the first item
> in the list, the first item gets highlighted and then the
> actual item that was selected gets highlighted.  I want
> the selected item to be immediately highlighted without
> the application first highlighting the first item in the
> ListView control.  Note that if the items are sorted, then
> the first item from the query used to populate the
> ListView control gets highlighted before the selected item
> gets highlighted.  Also I never tell the application to
> highlight the first item, this is somehow occurring
> automatically.

> Has anyone come across this problem before?  Is there
> anyway to prevent the application from automatically
> highlighting the first item in the ListView control when
> any item is selected?  Any help or hints on this topic
> would be greatly appreciated.  Thanks in advance.



Fri, 11 Mar 2005 22:47:42 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ListView Control Highlighted Item

2. Highlight an item in listview

3. Q: highlighting of selected items in a listview

4. ListView selected item highlight length

5. highlight listview item programatically

6. ListView: Selecting an Item and Highlighting it

7. Listview: highlight selected item?

8. ListViews / highlighting entire row of selected items

9. Highlighting (selecting) Listview Items

10. changing the background of a listview item in the listview control

11. Listview Control - moving items from one listview to another

12. Highlighting an item in a TREEVIEW control

 

 
Powered by phpBB® Forum Software