Click here to Skip to main content
15,889,775 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a runtime control for radiobutton list for calling it in each gridview cell, but I am unable to find the solution.
Posted

1 solution

You can create controls at runtime and add them to the Controls Container.

XML
public partial class Form1 : Form
    {
        List<RadioButton> radioButtons;
        public Form1()
        {
            InitializeComponent();
            radioButtons = new List<RadioButton>();
            for (int i = 0; i < 5; i++)
            {
                RadioButton radioButton = new RadioButton();
                radioButton.Top = i * 20;
                radioButton.Left = 5;
                radioButton.Text = "Test " + i.ToString();
                this.Controls.Add(radioButton);
                radioButtons.Add(radioButton);
            }
        }
    }


Hope it could help and i hope i have unterstand the question right.
 
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