It has been a while, but I think you can just set the form enabled to true or false as needed. While the controls do not visibly reflect disabled states they are not selectable. If all you are doing is preventing the user from interrupting a process that takes time this might be the best soution.
If that doesn't work then you can write a single procedure to do the job.
Realize though that not all controls have an enabled property so you have to allow for that.
You can shorten that by toggling the enable state by using NOTCode:Public Sub Enable_All(byval State as boolean) On error resume next For each C as control in Me.Controls C.enabled =State Next C On error goto 0 End Sub
Regarding detecting Control arrays. This was discussed in depth on another forum over 16 years ago.Code:Public Sub Toggle_Enabled() On error resume next For each C as control in Me.Controls C.enabled = Not(C.enabled) Next C On error goto 0 End Sub
Bottom line was that there was no way to automatically determine if a control is a control array.
You could create a sub class that has a custom property or use the tag property to identify them
or even simpler use a control naming convention that identifies them as control arrays.
e.g. txtBarCodeCA, btnTotalsCA, etc...




Reply With Quote