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;
}
}
Try using item.EnsureVisible();
精彩评论