Enter springen in nächstest Textfeld und text dort makieren

BeAFrog

Grünschnabel
Hallo zusammen,

ich möchte, dass wenn ich Enter drücke, der Mauszeiger ins nächste Textfeld springt und idealerweise dort den Text markiert. (Das such ich auch noch für Tab)

Wäre für Hilfe dankbar ;O)

Gruß
BeAFrog

Edit:

Ich bin nun etwas schlauer, frage mich aber wie ich diese beiden codes zu einem verbinden kann.

Code:
Private Sub txtm1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    txtm2.SetFocus
End If
End Sub


Private Sub txtm1_KeyPress(KeyAscii As Integer)
    KeyAscii = NurZahlen(KeyAscii)
    Call lblcalc_Click
End Sub
 
Zuletzt bearbeitet:
Warum nicht gleich beides in das KeyPress-Event:
Visual Basic:
Private Sub txtm1_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then txtm2.SetFocus
    KeyAscii = NurZahlen(KeyAscii)
    Call lblcalc_Click
End Sub


Der Doc!
 
*freu*

Danke so in etwa dachte ich mir das. Zum Verständnis "vbKeyReturn" ist einfach Return, gell?
Hast Du auch noch eine Ahnung, wie ich den Text im nächsten Feld markiert bekomme (Idealerweise auch wenn man tab drückt)?

Vielen Dank nochmals das hilft mir schon sehr weiter.

Gruß
BeAFrog
 
Sorry, das mit dem Markieren hab ich übersehen, her nochmal der ganze Code:
Visual Basic:
Private Sub txtm1_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then txtm2.SetFocus
    KeyAscii = NurZahlen(KeyAscii)
    Call lblcalc_Click
End Sub
'Beim Eintritt in die zweite Textbox:
Private Sub txtm2_GotFocus()
    txtm2.SelStart = 0
    txtm2.SelLength = Len(txtm2.Text)
End Sub


Der Doc!
 
Zurück