Comment : déterminer si la touche Verr. Maj. est activée dans Visual Basic

L'objet My.Computer.Keyboard peut être utilisé pour déterminer l'état actuel du clavier, par exemple pour savoir si la touche VERR. NUM ou VERR. MAJ est activée.

Pour déterminer si la touche VERR. MAJ est activée

  • Pour déterminer si la touche VERR. MAJ est activée ou non, utilisez la propriété My.Computer.Keyboard.CapsLock. Le code suivant affiche un message sur l'état de la touche VERR. MAJ.

    If My.Computer.Keyboard.CapsLock Then
        MsgBox("CAPS LOCK is on")
    Else
        MsgBox("CAPS LOCK is off")
    End If
    

Voir aussi

Référence

Keyboard

Concepts

Accès au clavier (Visual Basic)