作者kevinwang123 (Kc Wang)
看板C_Sharp
标题[问题] 关於动态产生groupbox与radiobutton的问题
时间Mon Oct 1 21:19:40 2007
请问各位大大
我现在的groupbox与radiobutton
都是动态产生的
可是当我要取radiobutton的值的时候
却取不到
只有在直接把radiobutton用this.control.add才能用
this.control[radiobutton.name].text取的到
可是这样就失去了groupbox的意义了
但是我现在是直接把radiobutton放在groupbox里
不知道各位大大有没有什麽好方法
附上code
谢谢各位大大了!
public void add_groupbox(int tmnc_index)//动态RadioBox的设定
{
this.groupbox1 = new System.Windows.Forms.GroupBox();
this.rb1 = new System.Windows.Forms.RadioButton();
this.rb2 = new System.Windows.Forms.RadioButton();
this.groupbox1.Controls.AddRange(new
System.Windows.Forms.Control[] { this.rb1, this.rb2 });
this.groupbox1.Name = "group_" + tmnc_index.ToString();
this.groupbox1.Location = new System.Drawing.Point(10,(tmnc_index + 1) * 50);
this.groupbox1.Size = new System.Drawing.Size(200, 50);
this.rb1.Text = "删除栏位";
this.rb1.Checked = true;
this.rb1.Location = new System.Drawing.Point(10, 10);
this.rb1.Name = tmnc_index.ToString() + "_delete";
this.rb2.Text = "不做处理";
this.rb2.Location = new System.Drawing.Point(10, 40);
this.rb2.Name = tmnc_index.ToString() + "_bypass";
this.rb2.Checked = false;
this.groupbox1.TabIndex = tmnc_index;
this.Controls.Add(groupbox1);
}
我是想用tmnc_index来取radiobutton的text来进阵列
再来进SQL决定要删除的栏位这样
谢谢各位大大了!!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.224.97.119