Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

Sign in to follow this  
crixalves

Desligar teclado

Recommended Posts

crixalves

Ola,

Gostava de saber, se alguém sabe como desligar o teclado em vb.net.

A minha ideia é que o teclado não desencadei eventos durante um determinado período de tempo. Não sei se me fiz entender bem...

Se alguém souber..

Share this post


Link to post
Share on other sites
bioshock

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each C As Control In Controls
            AddHandler C.KeyPress, AddressOf Form1_KeyPress
        Next
End Sub

Private Sub Form1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress, TextBox1.KeyPress
        If Char.IsLetter(e.KeyChar) Then
            e.Handled = False
        Else
            e.Handled = True
        End If
End Sub
End Class

Apenas vai aceitar letras. Ou seja, vai bloquear os eventos do teclado.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.