Reputation: 335
I've created a checked listview programmatically, with one of the columns being an editable textbox. I want to enable or disable the subitem on each row according to the state of the checkbox, but can't find a property or a way to access the subitem's edit state. I've tried to cast the subitem back to a control, but that didn't work as well.
Upvotes: 3
Views: 889
Reputation: 335
This is the solution I used. I hope there's a more elegant one: I created a List of TextBoxes and as I added a textbox to a ListViewItem I also added it to the list. In addition, I added a Tag to each ListViewItem with the TextBox's name. Now, when I check or uncheck a certain row I get the name of the control from the tag via lstItemList.Items[e.Index].SubItems[3].Tag.ToString() and search for it in the list. I change the Enabled property of the located TextBox.
Upvotes: 0