Home » Controls » How to scroll for selected ListView item
How to scroll for selected ListView item
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 'Controls - How to scroll for selected ListView item Option Explicit 'If you selected an item in ListView control within your code, Not always the 'item will be visible to the user. The following code will assure that the 'selected item will be visible. 'Add ListView control to your form and 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. Private Sub Form_Load() Dim x As Integer With ListView1 For x = 1 To 20 .ListItems.Add Key:="Item " & x, Text:="MyItem" & x Next x 'To select "Item 20" .SelectedItem = .ListItems("Item 20") .SelectedItem.EnsureVisible End With End Sub |
Enjoy this article?
Filed under: Controls
Leave a comment