Tab en cajas de texto
como hago para que estando sobre un textbox pueda detectar que han presionado la tecla {TAB} ?
=(
gracias
=(
gracias
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then MsgBox "Se presionó TAB"
End Sub
Saludos
If KeyCode = vbKeyTab Then MsgBox "Se presionó TAB"
End Sub
Saludos
claro, este código sólo sirve para un TextBox llamado Text1.
Si vas a tener varios TextBox, lo mejor es que te crees una matriz de controles, y así todos ejecutarán el mismo evento:
(Para crear la matriz de cajas de texto, simplemente seleccionas el TextBox, y le haces Copiar-Pegar, VB ya te pregunta se lo quieres convertir). Luego, el evento será este otro:
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then MsgBox "Se presionó TAB"
End Sub
Si no lo haces así, tendrás que copiar la linea de instrucción en el evento _KeyDown de todos los TextBox que tengas.
saludos
Si vas a tener varios TextBox, lo mejor es que te crees una matriz de controles, y así todos ejecutarán el mismo evento:
(Para crear la matriz de cajas de texto, simplemente seleccionas el TextBox, y le haces Copiar-Pegar, VB ya te pregunta se lo quieres convertir). Luego, el evento será este otro:
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyTab Then MsgBox "Se presionó TAB"
End Sub
Si no lo haces así, tendrás que copiar la linea de instrucción en el evento _KeyDown de todos los TextBox que tengas.
saludos