commandbutton
¿ Que hay que hacer, para que una ves insertado un command button y poniendole por ejemplo un número en la propiedad captión, actue el comand cuando pulsamos ese número en el teclado?
O eso(Alt_). O interceptando las pulsaciones con el evento keypress y poniendo codigo segun la tecla pulsada. Tendras que utilizar la propiedad del Form.Keypreview.
Un saludo.
Un saludo.
UN POCO TARDE, PERO SIRVE, POR SI AUN ME ESTABAS ESPERANDO
Option Explicit
Private Sub Command1_Click()
MsgBox "click 1"
End Sub
Private Sub Command2_Click()
MsgBox "click 2"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKey1 Or KeyCode = vbKeyNumpad1 Then
Command1_Click
Else
If KeyCode = vbKey2 Or KeyCode = vbKeyNumpad2 Then
Command2_Click
End If
End If
End Sub
Private Sub Form_Load()
Form1.KeyPreview = True
End Sub
Option Explicit
Private Sub Command1_Click()
MsgBox "click 1"
End Sub
Private Sub Command2_Click()
MsgBox "click 2"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKey1 Or KeyCode = vbKeyNumpad1 Then
Command1_Click
Else
If KeyCode = vbKey2 Or KeyCode = vbKeyNumpad2 Then
Command2_Click
End If
End If
End Sub
Private Sub Form_Load()
Form1.KeyPreview = True
End Sub
kiero k pongan en la pagina los metodos de un command button de un text box y de un formulario
