I have a checked ComboBox in my form:
What I want to do with the values of the checked values is to add them to the list of my temp object (that accepts a list of integers).
My problem is the following.
When I use this code (for testing purposes)
foreach (object i in checkedComboBoxEdit1.Properties.GetItems().GetCheckedValues())
{
MessageBox.Show("Value:" + i.ToString() );
//temp.intList.Add((int)i);
}
I get what I want (a pop up for every checked item with the value of it)
However, when I pull my wanted method out of comment ( temp.intList.Add((int)i);
), it throws an exception:
My other properties of my temp object are just fine. What is wrong with my code?
My object has a default constructor and the following property: List<Int> intList = new List<Int>()
What is wrong with my code?
Aucun commentaire:
Enregistrer un commentaire