chi sa dirmi come si usa??
Private Sub Form_KeyPress(KeyAscii As Integer)??
io voglio far apparire un msg box on press "P"
aiuto!!
chi sa dirmi come si usa??
Private Sub Form_KeyPress(KeyAscii As Integer)??
io voglio far apparire un msg box on press "P"
aiuto!!
questo dice tutto
prova così:
codice:Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 80 Or KeyAscii = 112 Then MsgBox "hai premuto P" End If End Sub![]()
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 112 Then ' 112 corrisponde al tasto p
msgbox "Hai premuto P"
end if
end sub
' invece di msg potresti anche cambiare la lettera premuta
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 112 Then ' 112 corrisponde al tasto p
KeyAscii = 97 ' di da A
end if
end sub
....se anche tu come me sei affetto da poltronite acutissima, e non vuoi sempre andare a cercare i corrispettivi codici ASCII di una lettera usa anzi che:
code:--------------------------------------------------------------------------------
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 80 Or KeyAscii = 112 Then
MsgBox "hai premuto P"
End If
End Sub--------------------------------------------------------------------------------
code:--------------------------------------------------------------------------------
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("P") Or Asc("p") Then
MsgBox "hai premuto P"
End If
End Sub--------------------------------------------------------------------------------
Bye.