Is there not a way to do the following??
For each ctrl as Control in Me.Controls.Where(function(x) x.Enabled = False)
ctrl.Enabled = True
Next
Every which way I try, I get 'Where' is not a member of 'System.Web.UI.ControlCollection' presumably because ControlCollection is not enumerable?
Most LINQ extension methods extend the type-safe IEnumerable(Of T).
ControlCollection predates generics and only implements IEnumerable, so the extension methods will not work.
You need to call .Cast(Of Control)() to return an IEnumerable(Of Control) which will accept extension methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With