jueves, 6 de noviembre de 2014

C# - Como hacer que un textbox solamente acepte numeros (usando el evento KeyPress)

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            char ch = e.KeyChar;
            if (!Char.IsDigit(ch) && ch != 8)
                e.Handled = true;
        }

No hay comentarios.:

Publicar un comentario