This following example creates radio button controls and set their text from an array of strings programmatically.

Create radio buttons from array
- private void button2_Click(object sender, EventArgs e)
- {
- string[] string_Array = new string[3];
- string_Array[0] = "USA";
- string_Array[1] = "India";
- string_Array[2] = "Germany";
- System.Windows.Forms.RadioButton[] btnRadio = new System.Windows.Forms.RadioButton[3];
- for (int i = 0; i < 3; ++i)
- {
- btnRadio[i] = new RadioButton();
- btnRadio[i].Text = string_Array[i];
- btnRadio[i].Location = new System.Drawing.Point(10, 30 + i * 20);
- this.Controls.Add(btnRadio[i]);
- }
- }