• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 342
  • Last Modified:

Listview auto-insert to Row

Greetings,

I need the following to occur, but am having difficulty making it happen.

I have a Listview set up with multiple Rows and 2 Columns. A name is entered into the first Column by the user.

If the Listview Count = 1 only, I need the second Column to auto-update with the word 'Default'.
I have tried SendKeys to get the focus into the first Row, but this doesn't always work. Can someone please suggest a better way.

Thank you.

Regards,
   Tony

0
tvtech
Asked:
tvtech
1 Solution
 
Ryan ChongCommented:
Hi, use listview1.listitems(i).selected = true; i = listview.listitems.index

0
 
TimCotteeCommented:
Private Sub ListView1_AfterLabelEdit(Cancel As Integer, NewString As String)
    If ListView1.ListItems.Count = 1 Then
        ListView1.ListItems(1).SubItems(1) = "Default"
    End If
End Sub


Is all you need, this detects that the column label has changed, and if there is only one item then the second column is set to "Default", nothing happens if there is more than one row.
0
 
tvtechAuthor Commented:
Thanks very much for the response. Much appreciated.

Regards,
   Tony
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now