Listview Question

V

vqthomf

Hi I was wondering is there is a way to move a selected record/Row to the top
of the listview control just the like TopIndex in the normal list control?.
TIA
Charles
 
M

michelxld

Hello Charles

you may try

Dim i As Integer
For i = 1 To ListView1.ListItems.Count
ListView1.ListItems(i).EnsureVisible
'8 is the Item to place at TopIndex
If 8 = ListView1.GetFirstVisible.Index Then Exit For
Next i


Regards
miche
 
M

michelxld

Re

and for the Selected item...

Dim i As Integer
For i = 1 To ListView1.ListItems.Count
ListView1.ListItems(i).EnsureVisible
If ListView1.SelectedItem.Index = ListView1.GetFirstVisible.Index The
Exit For
Next i


Regards
miche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top