Question : How to scroll to selected item listbox vb.net

Hi!

Have a listbox that can contain of 200 rows.
If i want to select example row 101, it wil select the row.
But i cant see the selected row on screen.

How do i make the listbox to scroll to selected row.
So i can see the selected row on screen.

I am using vb.net.

Answer : How to scroll to selected item listbox vb.net

Try this solution given in the following link.
http://cuinl.tripod.com/Tips/scroll-listview.htm

Add ListView control to your form (Named ListView1)
Set the ListView View property to 3 - lvwReport
Right click on the ListView Control, choose Properties from the menu, select the 'Column Headers' Tab, Press 'Insert Column' button, type in the 'Text' Text Box "MyHeader", and press the OK button.


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Private Sub Form_Load()
   Dim x As Integer
'the 4 lines below add 20 items to your ListView:
'MyItem1 named 'Item 1', MyItem2 named 'Item 2' and so on.
  With ListView1
      For x = 1 To 20
         .ListItems.Add Key:="Item " & x, Text:="MyItem" & x
       Next x
'Replace the "Item 20" below with the Item name that you want to select
       .SelectedItem = .ListItems("Item 20")
       .SelectedItem.EnsureVisible
   End With
End Sub
Random Solutions  
 
programming4us programming4us