[問題] 關於動態產生groupbox與radiobutton的問題

看板C_Sharp作者 (Kc Wang)時間18年前 (2007/10/01 21:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
請問各位大大 我現在的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
文章代碼(AID): #170FFjtp (C_Sharp)