PDA

View Full Version : چگونگی کار به کلیدenter



shabnama
یک شنبه 02 اسفند 1388, 18:46 عصر
سلام
چگونه می شود با کلید enter بر روی text box ها ، command ها و label هاحرکت کرد.

فوری


ممنون

polisoftco
دوشنبه 03 اسفند 1388, 00:49 صبح
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1.SetFocus
End If
End Sub



یا ، بجای Text2.Setfocus عبارت SendKeys vbTab رو بزار.
SendKeys vbTab : کلید تب رو شبیه سازی میکنه.



Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys vbTab
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys vbTab
End If
End Sub