mercredi 20 avril 2016

Use A Checkbox to add or Delete items from a list

I'm currently writing a winforms program in C#(VS2015), and I'm trying to determine that when a checkbox is checked, it passes some pre-created objects to a list(Which then feeds a combobox), and when it is not checked, it does not, actively removes these items from a list, and does not display them.

I was able to do this with just strings by creating a if statement that would add a string to the combobox directly, but I am now trying to do it with objects I've made and add them to the list, which the combobox looks at to populate using a keyvaluepair.

I can't get the rest of the winform to see the actual status of the check box, and I can't directly add the objects to the list, as it says that the objects i've created (Which are in the public area) are not seen by the checkbox.

Is it possible to pass the status of a checkbox throughout the whole winform, and not just at the private void chkMM_CheckedChanged(object sender, EventArgs e)?

I can post code as requested, but I'm kinda new to stackoverflow and I didn't just want to spam my 800 lines of code.




Aucun commentaire:

Enregistrer un commentaire