Setting the selection in a ListView

I am sorry if I've asked this question before, but I am unable to find it in my log.

I need to set the selection in a single selection listview.  I get thrown since it expects a collection.

Anybody got the answer handy?


Thanks,
Bob

ba272Asked:
Who is Participating?
 
peachapolConnect With a Mentor Commented:
Try this

int index = whatever item index that you want to select;
listView1.Items[index].Selected = true;
0
 
gr33nlant3rnConnect With a Mentor Commented:
There is one more step often forgotten...

listView1.Items[index].Selected=true;
listView1.Select();
0
 
ba272Author Commented:
Thanks.
0
All Courses

From novice to tech pro — start learning today.