Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlight Selected ListView Item 1

Status
Not open for further replies.

hitechboy78737

Programmer
Nov 8, 2004
82
US
When a listview item is selected via code, why does it not become highlighted like it is when a user selects the item with a mouse?

How do you highlight the selected item?

Thanks,
Kevin Howell
Austin, Texas
 
The list view is hiding the selection by default if the list is not in focus, so do one of the following:
Code:
        ListView1.Focus()
        ListView1.Items(index).Selected = True
Or:
Code:
        ListView1.HideSelection = False 'do it once in the designer
        ListView1.Items(index).Selected = True
The effect is different between the two ways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top