求教:控件数组里怎么区分焦点?
我用了个text控件数组,但彼此怎么区分焦点呢?我的意思是当我按下回车键那么焦点将要到炸个控件的下一个文本框。
如text1(index),我按下回车键后想让焦点转到text1(index+1)这上面,该怎么做了?
[解决办法]
Dim Focus As Integer
Private Sub Text1_GotFocus(Index As Integer)
Focus = Index '设置当前焦点
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Focus = Focus + 1
If Focus > 5 Then Focus = 0 '下标界限
Text1(Focus).SetFocus
End If
End Sub