加一行代碼就能了 Private Sub Command1_Click() Text1.SetFocus End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Text2.SetFocus End If End SubPrivate Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1.SetFocus End If End SubPrivate Sub Command1_Click() '处理你的事件 Text1.SetFocus End Sub
你在Click事件中写算了
Private Sub Command1_Click()
Text1.SetFocus
End Sub
If KeyAscii = 13 Then
Text2.SetFocus
End If
End SubPrivate Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End SubPrivate Sub Command1_Click()
'处理你的事件
Text1.SetFocus
End Sub