I have two files. One file with a class called Wood. I have created some objects with this class. These Objects include the attribute WoodType and a few others. I filled the objects into an array called woodObjects. The second file is a Form where I have a ListView.
So my goal was, to add all objects with their attributes to the ListView. I did it like that:
String[] row = { (listView1.Items.Count + 1).ToString(), WoodType, condition, isDry};
ListViewItem item = new ListViewItem(row);
listView1.Items.Add(item);
Success.
Now I have to update the attribute WoodType of one object in the ListView. I created a button "change Type" for that. I thought of the user clicking the row where the object ist he wants to change, and then clicking the button "change Type" to change WoodType it. To realize this, I wanted to take the index of the row, and than changing the value of "WoodType" with its set Accessor with something like the following:
woodObjects[indexOfRowFromListView].WoodType = "Oak Wood";
Yes, I know, this would never work like that. So my questions are: How can I select the correct index and how do I change the value of the attribute?
*I also thought of deleting the objects, but saving its values so I can create a new objects with the same values except WoodType. I appreciate every help!