I am trying to dynamically create Windows controls and add them to a Panel. For Button and Checkbox this has worked fine; I\'ve run into a problem with a GroupBox, though, with
All the items are a Location 0,0 Try this
int y=20;
for (int i = 0; i < grpbxVals.Count-1; i++)
{
radbtn = new RadioButton();
radbtn.Text = grpbxVals[i];
radbtn.Location=new System.Drawing.Point(6, y);
y+=radbtn.Height;
gb.Controls.Add(radbtn);
radbtn = null;
}
Also can insert a FlowLayoutPanel inside the GroupBox, then add the RadioButton to the FlowLayoutPanel, for a automatic placement of the components