I'm trying to get the tag associated with checkboxes on a form.
So I am using a recursion routine to loop through all of the controls on the form.
(I would have used a function and returned a List(Of string) but it seems that any local variable in the routine is re-dimensioned with each recursive call)
What I'm specifically having trouble with is the statement: If ctrl.checked = True Then...
(in subroutine getRoutinesToRun).
The compiler complains that .checked is not part of control.
I thought this should work since the test is after the TypeOf ctrl has already been decided to be a checkbox.
So, I'm not sure how to fix it, and confused as to why it doesn't work since the control at the decision point is supposed to be a checkbox.
So I'm looking at how to fix it, and why it isn't working as is.
Thank you all in advance.
Friend routinesToRun = New List(Of String)
Private Sub btnReportRun_Click(sender As System.Object, e As System.EventArgs) Handles btnReportRun.Click
' Get which reports to run
'routinesToRun is a list(of string) declared at the declarations level of the form
'since the recursion routine re-dimensions variables with each recursive call, otherwise
'I would have used a function and returned a List(Of String)
Private Sub getRoutinesToRun(ByVal Page As Control)
' Trying to get the tag associated with checkboxes on a form
' if the checkbox is checked
For Each ctrl As Control In Page.Controls
If TypeOf ctrl Is CheckBox Then
If ctrl.checked = True Then
If ctrl.Controls.Count > 0 Then