keypress event c#


SUBMITTED BY: menamagice

DATE: Aug. 9, 2017, 1:59 a.m.

FORMAT: Text only

SIZE: 465 Bytes

HITS: 219

  1. try to create HotKeys for my forms
  2. code
  3. private void FormMain_KeyPress(object sender, KeyPressEventArgs e)
  4. {
  5. if (e.KeyChar == (char)Keys.Enter)
  6. {
  7. MessageBox.Show("e");
  8. }
  9. }
  10. works for one key, but if I whant to use combination of keys like CTRL+N, try to use if (e.KeyChar == (char)Keys.Enter && e.KeyChar == (char)Keys.N) - but it's not working. I'm I right - using such code for keys combination?

comments powered by Disqus