private void Form1_KeyUp(object sender, KeyEventArgs e) { if (lecturaActivada == false) { return; } switch (e.KeyCode) { case Keys.NumPad0: case Keys.NumPad1: case Keys.NumPad2: case Keys.NumPad3: case Keys.NumPad4: case Keys.NumPad5: case Keys.NumPad6: case Keys.NumPad7: case Keys.NumPad8: case Keys.NumPad9: case Keys.D0: case Keys.D1: case Keys.D2: case Keys.D3: case Keys.D4: case Keys.D5: case Keys.D6: case Keys.D7: case Keys.D8: case Keys.D9: string Key = new KeysConverter().ConvertToString(e.KeyData); string caracter = Key.Substring(Key.Length - 1); textoLeido += caracter; consola.AppendText(caracter); break; case Keys.Enter: if (textoLeido.Length > 0) { lecturaActivada = false; consola.AppendText(System.Environment.NewLine); } break; case Keys.Back: if (textoLeido.Length > 0) { textoLeido = textoLeido.Substring(0, textoLeido.Length - 1); consola.Text = consola.Text.Substring(0, consola.Text.Length - 1); consola.SelectionStart = consola.Text.Length; consola.SelectionLength = 0; } break; } }