for (int i = 0; i < 6; i++) { radioaddons[i] = new RadioButton(); radioaddons[i].AutoSize = true; radioaddons[i].Name = "radioaddon," + i; radioaddons[i].Size = new System.Drawing.Size(50, 17); radioaddons[i].TabIndex = 10; radioaddons[i].Text = "" + arrayadd[i, 0]; radioaddons[i].UseVisualStyleBackColor = true; groupzustand.Controls.Add(radioaddons[i]); radioaddons[i].Location = new System.Drawing.Point(radioaddons[i-1].Location.X + radioaddons[i-1].Width + 5, 13); radioaddons[i].CheckedChanged += new System.EventHandler(this.radioaddon_CheckedChanged); }
private void radioaddon_CheckedChanged(object sender, EventArgs e) { int index = 0; for (int i = 0; i < 6; i++) { if (sender.Equals(radioaddons[i])) { index= i; this.Text = "Hello"; } }}
if (((RadioButton)sender).Text == radioaddons[i].Text) { index = i; this.Text = "hello"; }