# How to eliminate unlimited loop?

Posted by 小飞虾 on April 16, 1999 at 20:49:45:

连续两个text box, 皆有下列事件:
private sub text_LostFocus(index)
If Not IsCorrectDate(txtFields(index), False) Then
txtFields(index).setfocus
End If
end sub
Public Function IsCorrectDate(strDate As String, AllowEmpty As Boolean) As Boolean
If AllowEmpty Then
If strDate = "" Then
IsCorrectDate = True
Else
IsCorrectDate = IsDate(strDate)
End If
Else
If strDate = "" Then
IsCorrectDate = False
Else
IsCorrectDate = IsDate(strDate)
End If
End If
End Function

问题是在第一个text box按tab 跳过后curosr 就在这两textbox跳来跳去，无止尽。除了将两个连续text box 隔开外，有没有其他办法。

Follow Ups:

- Re: How to eliminate unlimited loop? 阿毛 23:33:11 4/16/99 (3)
  - 这是讨厌的问题 cww 21:57:33 4/18/99 (2)
    - Re: 这是讨厌的问题:validate 好像也不可以 小飞虾 14:55:11 4/19/99 (1)
      - 应该像这样做 cww 16:04:33 4/19/99 (0)