In the application that I am building I have a log window that contains a listview control. This listview control has two columns, a time stamp column and log description column. When an event happens it is added to the listview. The problem is that when about 15+ events happen they start being hidden since the control does not go that far. Is there a way to add an item to the listview control and then have the listview control scroll down to the bottom so that that entry is visible.

Thanks

Your post title does not convey your problem.

Use ListView1.TopItem property

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim k As New ListViewItem(TextBox1.Text)
        k.SubItems.Add(TextBox2.Text)
        ListView1.Items.Add(k)
        ListView1.TopItem = k
    End Sub

topitem is a read only property, so it won't work. I found a better way to do it through using the following code

Dim k As New ListViewItem(TextBox1.Text)

k.SubItems.Add(TextBox2.Text)

ListView1.Items.Add(k)
ListView1.EnsureVisible(ListView1.Items.Count)

EnsureVisible is a right choice. TopItem property - I have tested this code with VS 2005 and VS 2008 - it is not a readonly.

Thanks

i am using vb .net 2003 have not upgraded yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.