Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListView Control. Setting Scrolling

Status
Not open for further replies.

markphsd

Programmer
Jun 24, 2002
758
US
I am using a listview control. When I add more items then can be seen on the list, i'd like to sett he list vieew control to scroll down to the last item.. is there any way to control the list view's scrolling?

Mark P.
Providing Low Cost Powerful Point of Sale Solutions.
 
Would this help:

ListView.EnsureVisible Method

And I found this:
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.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top