I'm trying to detect when the user presses the Return key while in a Winforms textbox, but neither control statement below works when I use Keys.Enter and/or Keys.Return. It does work when I detect other keys such as Alt and Shift. What am I missing? They only vague lead that I have is that I'm testing this on a MacBook keyboard (running Windows), but surely those keys are mapped 100% correctly?
private void txtInput_KeyUp(object sender, KeyEventArgs e)
{
if ((Control.ModifierKeys == Keys.Enter))
{
btnOK_Click(null, null);
}
if ((Control.ModifierKeys & Keys.Return) != 0)
{
btnOK_Click(null, null);
}
}