davecove
asked on
I'm doing ListView Wrong
I have winforms ListView to which I have added items that have subitems. Looks good. I have enabled CheckBoxes. I have a ListView.Click handler enabled. When I click on a row, nothing happens... surprising, but OK.
When I click on a checkbox in a row, the ListView.Click() handler fires but thows an exception on the first line:
ListViewItem item = alarmList.SelectedItems[0] ;
In fact, SelectedItems has count of 0. It is like the line is not selected, even tho it responded to the Click. How can this be?
How can I get the Item for the checkBox I just clicked on?
Dave
When I click on a checkbox in a row, the ListView.Click() handler fires but thows an exception on the first line:
ListViewItem item = alarmList.SelectedItems[0]
In fact, SelectedItems has count of 0. It is like the line is not selected, even tho it responded to the Click. How can this be?
How can I get the Item for the checkBox I just clicked on?
Dave
ASKER
I tried ItemChecked, but that also fires off when an item is added to the list. Apparently being instantiated counts as a checked event.
I am doing a lot of add/delete in this list and I don't want to get triggered on the .Add()s.... only when the user actually does something. That's why the .Click()
Dave
I am doing a lot of add/delete in this list and I don't want to get triggered on the .Add()s.... only when the user actually does something. That's why the .Click()
Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window