3

I have a ListView and I do some select on the selected change event

    private void seleccionarIndexEnLista(int i)
    {
        lstvClientes.Items[i].Selected = true;
        lstvClientes.Items[i].Focused = true;

    }

but if the selected item is out of the view and gets selected, the scrollbar doesn't move, so I don't see that it is selected until I move the scrollbar.

Can I move the scrollbar when I do the select in the code to fix this?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Cristo
  • 700
  • 1
  • 8
  • 20
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Nov 17 '12 at 03:42
  • C# winforms. @john i take note for next questions :D – Cristo Nov 17 '12 at 16:47

1 Answers1

2
lstvClientes.Items[i].EnsureVisible();
Alex
  • 811
  • 7
  • 11
  • Somehow, I failed to notice this 100% correct answer before repeating it with my own. If a mod wants to delete mine, feel free. I have marked for deletion as redundant. Oops. – XIVSolutions Nov 17 '12 at 04:40
  • Yeeeah. But it's a method not a property: lstvClientes.Items[lstvClientes.Items.Count - 1].EnsureVisible(); thank you very much – Cristo Nov 17 '12 at 16:45