list view if statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • megasin1
    New Member
    • Dec 2009
    • 1

    list view if statement

    im getting an error from reading of a listview which has items in, but none have been selected yet. I need an if statement which says something like "if (no item is selected == true) {set selection;}
    if it helps its for a button.
    regards
    Mike
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Check the SelectedIndex property. -1 is the value when nothing is selected.

    You will find a lot of information on this if you just check the MSDN for the control.

    Represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views.


    If you are allowing multiple selection the check the SelectedIndices collection.

    Comment

    Working...