[.NET] 將多個checkbox的名稱加入listbox
大家好~
抱歉 有問題想要問問大家>"<
是這樣的..
我做的是類似購物網的東西
裡面有一個tabcontrol 其中有groupbox 並且在groupbox中有很多checkbox
然後在旁邊有一個listbox
我寫的程式碼是這樣的:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
For Each ctrlb As Control In Me.Controls
If TypeOf (ctrlb) Is TabControl Then
For Each ctrl As Control In ctrlb.Controls
If TypeOf (ctrl) Is TabPage Then
For Each ctrla As Control In ctrl.Controls
If TypeOf (ctrla) Is GroupBox Then
For Each ctrln As Control In ctrla.Controls
If TypeOf (ctrln) Is CheckBox Then
If CType(ctrln, CheckBox).Checked =
True Then
ListBox1.Items.Add(123)
End If
End If
Next
End If
Next
End If
Next
End If
Next
End Sub
期中的問題就是
我雖然從tabcontrol中找到checkbox的checked為true的有哪些
但是我最後我listbox的item加入的部分 我希望的是加入被選到的checkbox的名稱
但是不知道怎麼抓到..
(我在程式碼裡面是打加入123)
請問有人可以幫幫忙嗎@Q@
--
◢█ █◣ 討厭~下面還沒熟~不能吃啦~
◢ ◣ >\\\<█ ◢◢ ◣
◢◢◣ ◣ ~●──●~ ◢◢ ◣
◣ ◣█ ██ ◢ ─ ▉
◢ ◣▄ █▄ ─ ─ ◢
◢ ◢◣ ▆▆▆▆▆ ██ ─ ◢ψQSWEET
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.128.142.113
→
07/07 19:19, , 1F
07/07 19:19, 1F
→
07/07 19:36, , 2F
07/07 19:36, 2F
→
07/07 19:40, , 3F
07/07 19:40, 3F
→
07/07 19:40, , 4F
07/07 19:40, 4F
→
07/07 20:00, , 5F
07/07 20:00, 5F
→
07/07 20:01, , 6F
07/07 20:01, 6F
→
07/07 20:01, , 7F
07/07 20:01, 7F
→
07/07 20:06, , 8F
07/07 20:06, 8F
→
07/07 20:07, , 9F
07/07 20:07, 9F
推
07/07 20:25, , 10F
07/07 20:25, 10F
推
07/07 20:42, , 11F
07/07 20:42, 11F
討論串 (同標題文章)