Is there a more elegant way to do this? :
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is txtBase Then
Dim ctrl1 As txtBase = ctrl
ctrl1.ioEnable(value)
End If
If TypeOf ctrl Is pnlBase Then
Dim ctrl1 As pnlBase = ctrl
ctrl1.ioEnable(value)
End If
Next
"Me" is a form. and txtBase and pnlBase are subclassed from textbox and panel respectively. Both the classes have .ioEnable method.
Ideally I would like to add an abstact (overridable) .ioEnable method to the Control class, so that I could code :
For Each ctrl As Control In Me.Controls
ctrl.ioEnable(value)
Next
If I then write a .ioEnable for my btnBase and my pgfBase, I would not have to worry about this anymore.