If KeyAscii = 13 Then Text48.SetFocus End If运行到KEYASCII时还是提示变量未定义!请大家帮帮忙!
Private Sub Text47_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii = vbKeyReturn Then Text48.SetFocus End If End Sub
Private Sub Text47_Change() If KeyCode = vbKeyReturn Then Text48.SetFocus End If End Sub ----------------------------------------------- 在Change中是不能访问KeyCode的, 只能在 Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)End Sub 这里访问KeyCode这个变量
你可能是设计时双击Text47打开吧,一般打开的是Text47_Change事件处理过程,根据你想实现的功能看,应该用Text47_KeyPress才对,注意到没有Text47_Change过程是没有参数的,Text47_KeyDown带有参数KeyAsciiPrivate Sub Text47_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then Text48.SetFocus End If End Sub
Text48.SetFocus
End If
Text48.SetFocus
End If运行到KEYASCII时还是提示变量未定义!请大家帮帮忙!
If KeyAscii = vbKeyReturn Then
Text48.SetFocus
End If
End Sub
If KeyCode = vbKeyReturn Then
Text48.SetFocus
End If
End Sub
-----------------------------------------------
在Change中是不能访问KeyCode的,
只能在
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)End Sub
这里访问KeyCode这个变量
If KeyAscii = vbKeyReturn Then
Text48.SetFocus
End If
End Sub