Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can force a list box to scroll to the most recently added item by coding:
listBox.TopIndex = listBox.Items.Count - 1;
and I can position to a specific listBox item by coding:
listBox1.TopIndex = gotoIndex;

How can I perform the same functions in a ListView details view?
Posted

ListView has the TopItem property that you could use.
 
Share this answer
 
Please try ListView.EnsureVisible(int index). See here: http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.ensurevisible.aspx[^]
 
Share this answer
 
Comments
fjdiewornncalwe 23-Jan-11 22:30pm    
Bang On, Manfred. Just what I was thinking.
Sergey Alexandrovich Kryukov 24-Jan-11 0:41am    
Correct answer - a 5
ListView.EnsureVisible(int index) works. Thanks!
 
Share this answer
 
Comments
fjdiewornncalwe 23-Jan-11 22:31pm    
How about crediting Manfred with the correct answer and marking it as the correct one. Only you have the power to complete this task.
Manfred Rudolf Bihy 24-Jan-11 6:43am    
Thanks Marcus!
The code causes an automatic scroll to the most current line
listView1.Items[listView1.Items.Count - 1].EnsureVisible();

Exactly what was needed! Thanks Manfred.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900