How to reverse listview?

J

Jozef Jarosciak

Hi, my program is adding (every hour) a line to listview and into its 7
columns.

Problem is that it is adding it to the bottom of the list, so after
couple of hours, my users need to scroll down to see the most recent
results.

What I'd like is to have some function to reverse listview order after
I add the line. (chronologically)

Thanks.

Jozef Jarosciak
 
G

Guest

Instead of listview.Items.Add( "New Item"), try listview.Items.Insert( 0,
"New Item" ). That should insert the new item at index 0.
 
M

Morten Wennevik

Hi Jozef,

In addition to Phil's answer, you may also want to check out the ListView.EnsureVisible(index) method that will scroll if necessary to ensure the item is visible.
 
J

Jozef Jarosciak

Morten, thanks, that was it. Great. It should be acceptable for my
users.
Joe
 

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