I have a set of routines that do various things to controls - enable, visible, lock and so on. It is faster, cleaner and prevents screen flickering when setting a property that is already set. Here is one such routine:
I use this syntax to call it:
All works fine when I pass it textboxes and comboboxes, but when I try to pass it checkboxes, it is doing an unwanted conversion to ByVal. The value of the checkboxes is what I am getting in the routine, rather than a reference to the control, so of course, any action I take in the Sub has no effect on the actual control. Trying to set properties throws an error, and setting the value does not change the control.
Any ideas why checkboxes are not handled correctly, and if there is a way to force them to behave?
Code:
Public Sub gbl_CtlsAbled(ByRef arr As Variant, ByVal Stav As Boolean)
Dim i&
For i = LBound(arr) To UBound(arr)
With arr(i)
If .enabled <> Stav Then .enabled = Stav
End With
Next i
End Sub
Code:
gbl_CtlsAbled arr:=Array(cboTitul, cboRokVydani, cboAutori), Stav:=tglPridat
Any ideas why checkboxes are not handled correctly, and if there is a way to force them to behave?