lundi 20 mars 2017

How can I check whether dynamically-created Checkboxes are checked (VB.NET)?

I have a start on looping through dynamically-created Checkboxes:

For Each cntrl As Control In Me.Controls
    If TypeOf cntrl Is CheckBox Then
        If (cntrl As CheckBox).Checked Then
            'Do Something
        End If
    End If
Next

...but I don't know what I need instead of this line:

If (cntrl As CheckBox).Checked Then

...which was just a guess and which does not compile.




Aucun commentaire:

Enregistrer un commentaire