【发布时间】:2015-12-03 23:39:34
【问题描述】:
我在这里尝试做的是循环通过不同的控件,如果任何控件获得焦点以禁用按钮。这是我用于另一个任务的循环,所以我有点基于这个......
Dim cControl As Control
For Each cControl In Me.controls
If Not cControl.Container Is framClient Then
If Mid(cControl.Name, 1, 3) = "txt" Or Mid(cControl.Name, 1, 3) = "msk" Or Mid(cControl.Name, 1, 3) = "cbo" Then
'WHAT I'm trying to do here is
'if cControl.gotfocus then
'cmdExit.enabled=false
'end if ' but it barks at me
'cControl.Enabled = False
End If
End If
Next
我没有将这些文本框放在一个数组中,我不想遍历每个文本框以查看是否获得焦点并执行任何操作。请看一下。
【问题讨论】: