Hi there,
I am using a listview control. After populating the listview, I want my cursor to jump to the last row and make it visible. how can i do that using vb code.
thanks in advance

newvbguy

I have a feeling you are going to need to use API calls, or possibly sendkeys. If you post the code or attach the project, I'll take a look at it, and see if I can't find a way to accomplish it.

Hello Friend!!!! Here is the solution....using EnsureVisible!! Try with this:


Private Sub Form_Load()
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "TEST"
.ListItems.Add 1, , "5"
.ListItems.Add 1, , "4"
.ListItems.Add 1, , "3"
.ListItems.Add 1, , "2"
.ListItems.Add 1, , "1"
Set .SelectedItem = .ListItems(1)
.SelectedItem.EnsureVisible
End With
End Sub

Hello Friend!!!! Here is the solution....using EnsureVisible!! Try with this:


Private Sub Form_Load()
With ListView1
.View = lvwReport
.ColumnHeaders.Add , , "TEST"
.ListItems.Add 1, , "5"
.ListItems.Add 1, , "4"
.ListItems.Add 1, , "3"
.ListItems.Add 1, , "2"
.ListItems.Add 1, , "1"
Set .SelectedItem = .ListItems(1)
.SelectedItem.EnsureVisible
End With
End Sub

i have used combobox for item name help, i need code and itemname in variable when i select item form bombo and i want to move cursor according to adding word in search tex.
pls help me send me coding at susamudre@yahoo.com
regards
santosh

Hi,

Use this code

Private Sub cmdShowList_Click()
    With ListView1
        .HideSelection = False
        .FullRowSelect = True
        .View = lvwReport
        .ColumnHeaders.clear
        .ListItems.clear
        .ColumnHeaders.Add , , "CHECKING"
        .ListItems.Add , , "1"
        .ListItems.Add , , "2"
        .ListItems.Add , , "3"
        .ListItems.Add , , "4"
        .ListItems.Add , , "5"
        .SelectedItem = .ListItems(.ListItems.Count)
        .SelectedItem.EnsureVisible
    End With
End Sub

Regards
Veena

This article has been dead for over six months. Start a new discussion instead.