Compact framework 2.0 detects input key in text field

I am developing a small application for Motorola 9090-G using .net compact framework 2.0.

My problem is that I cannot detect keypress input in the text box. How do you detect an introductory click in a text box?

None of the three detection methods work. Interestingly, it works in ppc emulator. However, it does not work on my real hardware.

private void tbxQTY_KeyDown(object sender, KeyEventArgs e)
{    
  if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter || e.KeyCode == Keys.Decimal)
  {
    QTYEntered();
    e.Handled = true;
  }

  if (e.KeyData == Keys.Enter || e.KeyData == Keys.Return)
  { do something }


  if (e.KeyValue == (char)13)
  { QTYEntered(); MessageBox.Show("test"); e.Handled = true; }
}
+3
source share
4 answers

For me, the answer was to use the KeyPress event, not KeyDown:

    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == 13)
        {
            // Enter
        }
    }
+3
source

The device may not handle the button press in a way that is available to you.

, ?

, , , HardwareButton.

0

OEM- -. , , "" "", , . .

Intermec . , ACTION Enter, F23 10 . ... , (.. , , ). , :

public bool IsReallyEnter(KeyEventArgs e);

KeyPress - , , , .

0

This is how I do it now, to move between fields and in the "last" field, I call the save function. I did not miss the key:

Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        Select Case e.KeyCode
            Case Keys.Enter
                ComboBox2.Focus()
        End Select
    End Sub
0
source

Source: https://habr.com/ru/post/1722307/


All Articles