我在這裏想要做的是通過不同的控件循環,如果任何控件獲得焦點來禁用按鈕。這是一個循環,我用了一個任務,所以我還挺立足它關閉這個...基於哪個控件擁有焦點的禁用/啓用按鈕
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
我沒有在一個陣列使這些文本框,我不想經歷每個文本框看看是否有焦點並做任何事情。請看一下。