Results 1 to 3 of 3

Thread: When command1 is clicked last item in listview gets selected

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    When command1 is clicked last item in listview gets selected

    Hi guys,

    How can i make it so when command1 is clicked,the last item in listview1 becomes selected?

    Thanks,
    Jamie.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: When command1 is clicked last item in listview gets selected

    Strange request but something as simple as this should work:
    Code:
    Private Sub Command1_Click()
        ListView1.ListItems(ListView1.ListItems.Count).Selected = True
        ListView1.SetFocus
    End Sub
    If you are usign Report view and would like to select entire row make sure FullRowSelect property is set to True.
    Another property to consider is HideSelection - if it's set to False then row selection is visible even when listview loses focus.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: When command1 is clicked last item in listview gets selected

    Or
    Code:
    ListView1.ListItems(ListView1.ListItems.Count).EnsureVisible

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width