Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have and application in which I have to add, on a form , about 9 Panels, each panel containing: 1 label, 3 radiobuttons.
It's something like a test form.
I must use Panels, because it will help me on checking the answers
I tried this, but the radiobuttons don't show up on the form:

C#
for (int i = 0; i < 9; i++)
           {
               Panel pan = new Panel();
               pan.Name = "panel" + i;
               pan.Location = new Point(46, 76 + i * 105);
              // pan.Size = new Size(340, 100);
               Label l = new Label();
               l.Text = "something";
               l.Font = new Font("Segoe UI", 12);
               l.AutoSize = true;

               RadioButton mr =new RadioButton();
               mr.Name = "mrb" + i;
               //mr.Location = new Point(46,90+i*105);
               mr.Font = new Font("Segoe UI", 12);
               mr.Show();
               RadioButton mr1 =new RadioButton();
               mr1.Name = "mrb" + i;
              // mr1.Location = new Point(46+mr.Size.Width+5, 90 + i * 105);
               mr1.Font = new Font("Segoe UI", 12);
              RadioButton mr2 =new RadioButton();
               mr2.Name = "mrb" + i;
              // mr2.Location = new Point(46+mr1.Size.Width+5, 90 + i * 105);
               mr2.Font = new Font("Segoe UI", 12);
               pan.Controls.Add(l);
               pan.Controls.Add(mr);
               pan.Controls.Add(mr1);
               pan.Controls.Add(mr2);
               ls.Add(pan);
               this.Controls.Add(pan);
               pan.Show();
           }
           }


A little help, please...
Thank you
Posted
Comments
Rabbil 29-Apr-13 7:06am    
You might be missing some of the properties...
for more info check http://msdn.microsoft.com/en-us/library/kyt0fzt1%28v=vs.100%29.aspx

1 solution

You should uncomment the location-statements and try to position them on the right location :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900