I´m adding controls dynamically onto my form, but I can’t see those new controls.
My code is:
frmFormulario myform = new frmFormulario();
for (int i = 0; i < elements.Count; i++)
{
String nm = elements[i].name;
String chk = "chk"+nm;
CheckBox checkboxWS = new CheckBox();
checkboxWS.Name = chk;
checkboxWS.Checked = true;
checkboxWS.Visible = true;
checkboxWS.Width.Equals(40);
myform.Controls.Add(checkboxWS);
myform.Controls.SetChildIndex(checkboxWS, 0);
}
Can anybody spot the problem?
Thanks
My environment is C# Visual Studio 2010
Try adding
after the for loop. If you want to completely work on this new window (myform) and discard the former or parent then try creating it in a new thread.
Hope it helps.