I'm trying to make a custom control that checks or clears all checkboxes on a page simultaneously when a designated checkbox is checked or cleared. I have this (non-working) code so far:
Public Shared Sub CheckUncheck(ByVal container As Control, ByVal blnChecked As Boolean)
Dim intCount As Integer = 0, intTotal As Integer = container.Controls(0).Controls.Count
Do While intCount < intTotal
If container.Controls(0).Controls(intCount).GetType = GetType(CheckBox) Then
Dim chk As CheckBox = CType(container.Controls(0).Controls(i), CheckBox)
chk.Checked = blnChecked
intCount += 1
The line that's giving me trouble is the one starting with "If container.Controls(0)"... Bad syntax that gives me this message: Operator '=' is not defined for types System.Type and System.Type.
What I'm trying to do, of course, is test to see if the control is a checkbox; and if it is, either check or clear it depending on the value of blnChecked.
View Complete Post