# 这个问题不难!!!!!!

Posted by Kent on September 26, 1998 at 14:05:05:

In Reply to: 问一个textbox所导至无穷回圈的问题 posted by 小马 on September 23, 1998 at 15:51:39:

原因是因为当你text1 lost focus 之后,这时form1上的active control已经变成form2,所以当你再把text1 setfocus,又会引发text2的lost focus,所以你只要把程式码改成下面这样就可以了

Private Sub Text1_LostFocus()
MsgBox "text1 LOSTFOCUS"
Text1.SetFocus
End Sub

Private Sub Text2_LostFocus()
If Form1.ActiveControl <> Text2 Then Exit Sub
MsgBox "text2 LOSTFOCUS"
Text2.SetFocus
End Sub

Follow Ups: