B. How can I programmatically highlight a listview control as though a user clicked on an item in the collection?
A. Try setting the backcolor in a manner similar to this:
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
Dim C As New System.Drawing.Color() ListView1.BackColor = C.Aqua
In .NET, the backcolor property is an object, not merely a value.
B. Try selecting the Listview control first like this:
ListView1.Select() ListView1.Items(1).Selected = True
After selecting the listview, then set the Selected property of the proper item to True.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.