Hi. I have a form contain 10 checkbox. how to count total checkboxes that has been checked? i search over the internet but not found any solution. please help me. i found a code, but when i apply it on my project it says "Unable to cast object of type System.Windows.Forms.MenuStrip' to type ComponentFactory.Krypton.Toolkit.KryptonCheckBox'". i think i have problems with Me.Controls(on the code)
this is the code, might helping you all.
note: i also use krypton toolkit (krypton checkbox).
Dim intTotalCheckBoxes As Integer = 0 Dim intCheckBoxesChecked As Integer = 0 For Each cb As checkbox In Me.Controls If cb.Checked = True Then intCheckBoxesChecked += 1 End If intTotalCheckBoxes += 1 Next lbl5.Text = intTotalCheckBoxes.ToString