I have a bit of coding like this:
VB Code:
Private Sub txtUser_KeyDown(KeyCode As Integer, Shift As Integer) txtUser.SelStart = 0 txtUser.SelLength = Len(txtUser.Text) If KeyCode = vbKeyReturn Then txtPass.SetFocus End If End Sub
but as you probably could guess im trying to select the text when i tab to it but i also want to be able to jump out again with the enter button
---
this will work for the highlighting of the text, but then i cant press return to jump out again
VB Code:
Private Sub txtUser_[B]GotFocus[/B]() txtUser.SelStart = 0 txtUser.SelLength = Len(txtUser.Text) If KeyCode = vbKeyReturn Then txtPass.SetFocus End If End Sub
---
and this will work for the jumping out but not selecting the text
VB Code:
Private Sub txtUser_[B]KeyDown(KeyCode As Integer, Shift As Integer)[/B] txtUser.SelStart = 0 txtUser.SelLength = Len(txtUser.Text) If KeyCode = vbKeyReturn Then txtPass.SetFocus End If End Sub
---
Does any body know of a solution?
I tried this aswellol
VB Code:
Private Sub txtUser_[B]KeyDown_GotFocus(KeyCode As Integer, Shift As Integer)[/B] txtUser.SelStart = 0 txtUser.SelLength = Len(txtUser.Text) If KeyCode = vbKeyReturn Then txtPass.SetFocus End If End Sub


lol
Reply With Quote
