views:

31

answers:

1

I have a ListView with about 400 entries. I need to search thru it for a value and when found I'm setting it to Selected and I would like ListView to somehow scroll to this item and show it on the screen.

How can I do this? Will setting .Focused do it?

        foreach (ListViewItem item in someListView.Items) {
            string varID = item.SubItems[0].Text;
            if (varID == someID) {
                item.Selected = true;
                item.BackColor = Color.Aquamarine;
                item.Focused = true;
                break;
            }
        }
+1  A: 

Try using item.EnsureVisible();

adrift