What I'm trying to do is changing cb1's checked to true without directly using its name, for that I'm changing tempcb's name to cb1 using string and then make tempcb's checked true.
CheckBox cb1 = new CheckBox(); //this should not be changed using its own name and only should change using tempcb for what I'm doing to work
string str = chkBxSettPShwMp.Name.ToString();
CheckBox tempcb = new CheckBox();
tempcb.Name = str;
tempcb.Checked = true;
Sadly it returns false. I strongly believe it's because of tempcb is a new checkbox so even I change it's not the same checkbox with cb1. Is there a way to do this? Thought of something like CheckBox tempcb = existing CheckBox(cb1);
would exist however, I couldn't find anything like that.
ps: This is not a multiplying question of my previous one, they told me in metastack that I have to ask this question separately.
Aucun commentaire:
Enregistrer un commentaire