jeudi 26 mars 2015

Count and get all the value of checked checkboxes in VB.NET

lets say i have a form, and under my form i have a panel, and under panel i have a groupbox, and under the groupbox i have another panel, and under of this panel i have a multiple checkboxes, now, how can i count how many checkboxes are checked and how can i get the value of checked checkboxes and put it in arraylist. i have a code but doesnt work.


my code:



Dim list As New ArrayList
Dim count As Integer
count = 0
If TypeOf element Is CheckBox Then

If cb.Checked Then
list.Add(cb.Text)
'End If
Else
For Each childElement In element.Controls
count += 1
Next
End If
MsgBox(count)
MsgBox(list)


thank you very much! any help will appreciate. sorry for y bad English.





Aucun commentaire:

Enregistrer un commentaire