ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listview Question (https://www.excelbanter.com/excel-programming/349571-listview-question.html)

vqthomf

Listview Question
 
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

michelxld[_41_]

Listview Question
 

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

--
michelxl
-----------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...fo&userid=1736
View this thread: http://www.excelforum.com/showthread.php?threadid=49823


michelxld[_42_]

Listview Question
 

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

--
michelxl
-----------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...fo&userid=1736
View this thread: http://www.excelforum.com/showthread.php?threadid=49823



All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com