I am developping a QCM application in c#, the user have the favour to choose the number of propositions so I am asking how to make radiobutton as many as the user want, in other word how to dynamicly make radiobutton.
I am waiting for a response, thks a lot :)
Kirtan PatelPosted Dec 28, 2009, 8:54 AM
Here is your Solution !!
if it helps you then check "Do you like this answer" check box :) please
you can Create Dynamic Radio Buttons By Following Code
private void button1_Click(object sender, EventArgs e)
{
int NumberOfRadioButtons = int.Parse(textBox1.Text);
for (int i = 0; i <= NumberOfRadioButtons; i++)
{
RadioButton rb = new RadioButton();
rb.Name = "radio" + i.ToString();
rb.Text = "Radio Button " + i.ToString();
rb.Location = new Point(10, 30*i);
rb.Size = new Size(100, 40);
this.Controls.Add(rb);
}
}
if still need help then let me know :)
srinivasPosted Dec 28, 2009, 8:57 AM
check this link i think it may help to you ,how to add controls at runtime