VB .NET - Using ListView to log activity

VB, Visual Studio 2005.

I am using a listview to log some activity in my app.

The problem I have is that every line I add I need to automaticallly scroll down to the last added line (to show the last added log line).

I already tried with:

myListView.items(last_item_index).focused=true

this piece of code only focus the item without showing it (scrolling down to view it)

Anyone knows how to do it ?

Thanks in advance..

Fede.

[543 byte] By [zancraft] at [2007-12-23]
# 1

Try...


myListView.SelectedIndex = myListView.Items.Count - 1

Hope this helps.

-Chad

ChadMoran at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
I also tried this, but this only select the item without navigate (showing) to it.
zancraft at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3

I just tried it... adding multiple items than using that works just fine. Automaticaly scrolls to the bottom of the list for me.

-Chad

ChadMoran at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4

Me.theListView.EnsureVisable(Me.theListView.Items.Count - 1)

this ensures the last item in the list is selected, even if it needs to be scrolled down

ahmedilyas at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5

Thanks a lot !

This worked ok :)

el_Fede at 2007-8-30 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified