Click here to Skip to main content
15,895,084 members

Comments by sadmoh (Top 6 by date)

sadmoh 14-May-18 13:46pm View    
i made my code very simple , any one can run it,

RadioButton[] brb = new RadioButton[20];
GroupBox[] gb = new GroupBox[5];
for (int b = 0; b < 5; b++)
{
GroupBox bg = new GroupBox();
gb[b] = bg;
gb[b].Name = "gb" + b.ToString();
gb[b].Location = new Point(60, 110 + b * 130);
gb[b].Size = new Size(550, 105);
gb[b].Text = "GBox"+b.ToString();
this.Controls.Add(gb[b]);
}
for (int o = 0; o < 5; o++)
{
Label lb = new Label();
lb.Name = lb1 + o.ToString();
sd = "lbl"+o.ToString();
lb.AutoSize = true;
lb.Text = (o + 1).ToString() + " - " + sd;
lb.Location = new Point(100, (100 + o * 130));
lb.Font = new Font(lb.Font, FontStyle.Bold);
this.Controls.Add(lb);
for (int k = 0; k < 4; k++)
{
RadioButton rb = new RadioButton();
brb[k] = rb;
brb[k].Name = "rb" +o.ToString()+ k.ToString();
if (k == 0) brb[k].Checked = true;
brb[k].Text = " - " + "RB"+o.ToString()+ k.ToString();
brb[k].Location = new Point(80, (100 + (o * 130) + (k + 1) * 22));
gb[o].Controls.Add(brb[k]);
this.Controls.Add(brb[k]);
}
gb[o].CausesValidation = true;
gb[o].Enabled = true;
this.Controls.Add(gb[o]);
}
sadmoh 13-May-18 15:07pm View    
u see here i named the groupBoxs as 0,1,2,3,4,and 5 when i want to checked on of the radiobutton in the groupBox numbered 0 , its cleared all radiobutton for all the radiobuttons in all groupBoxes.
sadmoh 13-May-18 15:03pm View    
here is an image for the run time!!!

https://photos.google.com/share/AF1QipM5GGF8OmZlqOGlz44JbMWZ-NuM-8d3fPSb2ZE_c-pIUnFqvDuHe-71Taea4O4lRQ/photo/AF1QipO-EzznCtFlMrtIM9xUtH_KE1eN3OEvMBXkA1dh?key=clJJLWp3Wl84SVBWNDVZWnRrTDhFclBiNU9yVG9B
sadmoh 13-May-18 14:55pm View    
i am sure all the groupBoxes are visible and i see it in the run time,
i will put here an image for the run time.
best regards
sadmoh 13-May-18 3:18am View    
when i remove
this.Controls.Add(rb);
the radiobutton disapeare from the form in the run time