# Re: 有 lostfocus , 无 getfocus

Posted by jutso on December 31, 1998 at 15:13:00:

In Reply to: 有 lostfocus , 无 getfocus posted by jutso on December 31, 1998 at 14:42:24:

我又把程式改成这样：
Private Sub Text1_LostFocus()

Debug.Print "text1 lostfocus"
MsgBox "text1 lost focus"
If Form1.ActiveControl Is Text2 Then
Debug.Print "active control is text2"
End If
Text1.SetFocus
DoEvents
End Sub

Private Sub Text2_GotFocus()

Debug.Print "text2 getfocus"

End Sub

Private Sub Text2_LostFocus()

Debug.Print "text2 lostfocus"
MsgBox "text2 lost focus"
If Form1.ActiveControl Is Text1 Then
Debug.Print "active control is text1"
End If
Text2.SetFocus
DoEvents

End Sub

也就是说在执行 text1_lostfocus 时，activecontrol
已经是 text2，但是为何 text2 的 getfocus 事件都没出现？

Follow Ups: