用户要求,当按下回车键的时候,光标跳到下一个文本框,我想,这其实很简单啊
不就是一个keypree吗,然后用一个sendkeys "{TAB}"就ok了。
但后来一想,窗体上有数十个文本框啊,这么多的keypress事件函数很不优雅,有更好的实现方法吗?

解决方案 »

  1.   

    Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
      If KeyAscii = 13 Then
         If Index = 4 Then Index = -1
         Text1(Index + 1).SetFocus
      End If
    End Sub
    此程序有5个text1数组!
      

  2.   

    n个文本筐弄成控件数组;  ok了也可以 用个commandbutton, 设置default=true, 然后在这个按钮的事件里面写sendkey, 当然也要判断如果全部填写完毕则...